@blinkk/root-cms 3.0.6 → 3.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +77 -0
- package/dist/app.js +6 -4
- package/dist/browser-client/browser-client.d.ts +148 -0
- package/dist/browser-client/embed-window.d.ts +66 -0
- package/dist/browser-client/emitter.d.ts +11 -0
- package/dist/browser-client.js +377 -0
- package/dist/{chunk-RXWDB3K4.js → chunk-4VZTYUQ7.js} +1 -1
- package/dist/{chunk-N4K6ICFR.js → chunk-AFBSITEO.js} +4 -6
- package/dist/{chunk-PNLLZXVY.js → chunk-AJDMNTZQ.js} +2 -2
- package/dist/chunk-J72JK4KR.js +8 -0
- package/dist/{chunk-7L5OI5ES.js → chunk-X5CNR4CK.js} +8 -4
- package/dist/cli.js +2 -1
- package/dist/client.js +2 -1
- package/dist/core/client.d.ts +5 -0
- package/dist/core/plugin.d.ts +1 -1
- package/dist/core/translations.d.ts +19 -4
- package/dist/core.js +4 -2
- package/dist/functions.js +4 -3
- package/dist/plugin.js +38 -7
- package/dist/shared/embed-protocol.d.ts +72 -0
- package/dist/shared/translation-languages.d.ts +67 -0
- package/dist/ui/AIPage-2N5UYBRX.js +1 -0
- package/dist/ui/AssetsPage-KLGNE6D6.js +1 -0
- package/dist/ui/CollectionPage-D7IG6526.js +1 -0
- package/dist/ui/ComparePage-726NIJW5.js +1 -0
- package/dist/ui/DataPage-YMSQCIVK.js +1 -0
- package/dist/ui/DataSourcePage-7VPFUG3K.js +1 -0
- package/dist/ui/DocTranslationsPage-FO7O76VK.js +1 -0
- package/dist/ui/DocumentPage-M7SJ4ITQ.js +1 -0
- package/dist/ui/EditDataSourcePage-Y7YK6IWT.js +1 -0
- package/dist/ui/EditReleasePage-XZ4RHHRT.js +1 -0
- package/dist/ui/EmbeddedAIPage-RJOUIPF2.js +1 -0
- package/dist/ui/EmbeddedDocumentPage-4TLMCDSO.js +1 -0
- package/dist/ui/{ImageEditorDialog-QEULJAT2.js → ImageEditorDialog-GGS4VFEA.js} +2 -2
- package/dist/ui/LogsPage-IGDDZGEI.js +1 -0
- package/dist/ui/NewDataSourcePage-YUPRHL7F.js +1 -0
- package/dist/ui/NewReleasePage-6HHLYOQP.js +1 -0
- package/dist/ui/NotFoundPage-A6OCYREA.js +1 -0
- package/dist/ui/ProjectPage-UHRXNN7O.js +1 -0
- package/dist/ui/ReleasePage-V2JMPWX7.js +1 -0
- package/dist/ui/ReleasesPage-SCR4SVKN.js +1 -0
- package/dist/ui/SettingsPage-5XKHPG6K.js +1 -0
- package/dist/ui/SidebarToolsPage-VXVRZ2C3.js +1 -0
- package/dist/ui/TaskPage-LDPRN3G6.js +1 -0
- package/dist/ui/TasksPage-DIXUWYXM.js +1 -0
- package/dist/ui/TranslationsArbPage-QPD3ZBT4.js +2 -0
- package/dist/ui/TranslationsEditPage-475Z7UPC.js +1 -0
- package/dist/ui/{TranslationsPage-OBN6CQZZ.js → TranslationsPage-674JU6L4.js} +32 -32
- package/dist/ui/{chunk-N4DFAIC5.js → chunk-2EPQJUGM.js} +1 -1
- package/dist/ui/{chunk-WKOX3VFN.js → chunk-2RAVKX2Z.js} +2 -2
- package/dist/ui/chunk-2S5HMST6.js +1 -0
- package/dist/ui/{chunk-V7RAXP2W.js → chunk-3E6CASIN.js} +1 -1
- package/dist/ui/chunk-4ALFT4ES.js +141 -0
- package/dist/ui/{chunk-KYKFNAX4.js → chunk-4FGASIIX.js} +1 -1
- package/dist/ui/chunk-4ISFTE2G.js +5 -0
- package/dist/ui/{chunk-SKEP5WYH.js → chunk-7SK47HHZ.js} +3 -3
- package/dist/ui/chunk-AAHM6RYJ.js +1 -0
- package/dist/ui/chunk-AGFPVTBA.js +1 -0
- package/dist/ui/chunk-BUNR5EU3.js +1 -0
- package/dist/ui/{chunk-N5Y5OWTV.js → chunk-BW2MKGNP.js} +1 -1
- package/dist/ui/{chunk-2225WAJ2.js → chunk-CAY5NM4Z.js} +1 -1
- package/dist/ui/{chunk-4KE2SZKH.js → chunk-D3UIZHRK.js} +1 -1
- package/dist/ui/{chunk-HYARD7BK.js → chunk-ENQKSLGJ.js} +1 -1
- package/dist/ui/chunk-FBSBL476.js +1 -0
- package/dist/ui/{chunk-NQB37NMX.js → chunk-FJLNXXE3.js} +1 -1
- package/dist/ui/chunk-GT5EQSEX.js +1 -0
- package/dist/ui/{chunk-KPJ53X55.js → chunk-HARRKJFZ.js} +1 -1
- package/dist/ui/{chunk-6E7PGMZX.js → chunk-HO3W4RVG.js} +1 -1
- package/dist/ui/{chunk-CVGYBXVH.js → chunk-J5E457OI.js} +1 -1
- package/dist/ui/{chunk-SEUH7LN2.js → chunk-JBHRZ4EX.js} +1 -1
- package/dist/ui/{chunk-W3HIZQ4Z.js → chunk-JS6TK4OP.js} +1 -1
- package/dist/ui/{chunk-BEDUTYQP.js → chunk-JTIQBW33.js} +1 -1
- package/dist/ui/{chunk-ORXEMIQC.js → chunk-KRNQ6L35.js} +1 -1
- package/dist/ui/chunk-LROR6N3B.js +7 -0
- package/dist/ui/{chunk-4CUWZQXT.js.LEGAL.txt → chunk-LROR6N3B.js.LEGAL.txt} +6 -1
- package/dist/ui/{chunk-6GPTGBA7.js → chunk-MSYTAJBV.js} +1 -1
- package/dist/ui/{chunk-RQKL4KXY.js → chunk-N3JSLTMV.js} +1 -1
- package/dist/ui/{chunk-NMBXHKIJ.js → chunk-NJMNOITA.js} +1 -1
- package/dist/ui/{chunk-D37DCENS.js → chunk-NSOTG64N.js} +1 -1
- package/dist/ui/chunk-NWHGT476.js +1 -0
- package/dist/ui/chunk-P2Z66DHV.js +1 -0
- package/dist/ui/{chunk-4IXGYXA2.js → chunk-PTPYMVFW.js} +1 -1
- package/dist/ui/{chunk-OVRTVMO5.js → chunk-Q7IU4QCY.js} +1 -1
- package/dist/ui/{chunk-XYBHH5L4.js → chunk-QF3GPZTI.js} +1 -1
- package/dist/ui/{chunk-AXETBZ6T.js → chunk-QHJOTXYB.js} +1 -1
- package/dist/ui/{chunk-UHWNLNP4.js → chunk-RHAJNURN.js} +1 -1
- package/dist/ui/chunk-SENZVSVZ.js +1 -0
- package/dist/ui/chunk-SKQECSUR.js +1 -0
- package/dist/ui/chunk-TOGLZDK3.js +1 -0
- package/dist/ui/chunk-TPJCPCRR.js +1 -0
- package/dist/ui/{chunk-EMYXSVTD.js → chunk-TVYAZN2Q.js} +1 -1
- package/dist/ui/{chunk-GDSSFO5R.js → chunk-UUVAD4U4.js} +1 -1
- package/dist/ui/{chunk-EGEB6N4J.js → chunk-VD6G5NV4.js} +11 -11
- package/dist/ui/{chunk-DXKEDMEI.js → chunk-VJUMFJIX.js} +1 -1
- package/dist/ui/chunk-W5DOO6ID.js +1 -0
- package/dist/ui/{chunk-6MOPIV5T.js → chunk-W6LP22IK.js} +1 -1
- package/dist/ui/{chunk-3XYCOR6Z.js → chunk-WFQU7V3W.js} +1 -1
- package/dist/ui/chunk-WMICEDOT.js +1 -0
- package/dist/ui/chunk-XMESZUC5.js +1 -0
- package/dist/ui/{chunk-T47V6AGW.js → chunk-XWX2622O.js} +1 -1
- package/dist/ui/chunk-YMBBWVBB.js +3 -0
- package/dist/ui/chunk-YXSXWFLZ.js +1 -0
- package/dist/ui/chunk-ZMS6NIGG.js +1 -0
- package/dist/ui/gcs-ECSDFCIU.js +1 -0
- package/dist/ui/ui.css +1 -1
- package/dist/ui/ui.js +1 -1
- package/package.json +7 -3
- package/dist/ui/AIPage-JPZ4QUB4.js +0 -1
- package/dist/ui/AssetsPage-GDJMKS3M.js +0 -1
- package/dist/ui/CollectionPage-5DVXJEET.js +0 -1
- package/dist/ui/ComparePage-LIXA6G66.js +0 -1
- package/dist/ui/DataPage-AP4Z5JPS.js +0 -1
- package/dist/ui/DataSourcePage-WO3ZKMFI.js +0 -1
- package/dist/ui/DocTranslationsPage-QKYFIVHP.js +0 -1
- package/dist/ui/DocumentPage-ON43I5KM.js +0 -1
- package/dist/ui/EditDataSourcePage-XVMEV2LJ.js +0 -1
- package/dist/ui/EditReleasePage-A2NB5TFG.js +0 -1
- package/dist/ui/LogsPage-4LZJX3O4.js +0 -1
- package/dist/ui/NewDataSourcePage-4YWX7IOG.js +0 -1
- package/dist/ui/NewReleasePage-HWLVTEXX.js +0 -1
- package/dist/ui/NotFoundPage-72AXQAYX.js +0 -1
- package/dist/ui/ProjectPage-L4GYDIA5.js +0 -1
- package/dist/ui/ReleasePage-43BSWL5B.js +0 -1
- package/dist/ui/ReleasesPage-CJXAZBP6.js +0 -1
- package/dist/ui/SettingsPage-SYXAMKSF.js +0 -1
- package/dist/ui/SidebarToolsPage-OFF5BOXP.js +0 -1
- package/dist/ui/TaskPage-HBDLHFI5.js +0 -1
- package/dist/ui/TasksPage-OLCDTQNB.js +0 -1
- package/dist/ui/TranslationsArbPage-E3NCMAMS.js +0 -2
- package/dist/ui/TranslationsEditPage-IWOI7Y5G.js +0 -1
- package/dist/ui/chunk-32LRQ5MJ.js +0 -1
- package/dist/ui/chunk-3HVDIPSS.js +0 -1
- package/dist/ui/chunk-3IDOZ4MG.js +0 -1
- package/dist/ui/chunk-4CUWZQXT.js +0 -7
- package/dist/ui/chunk-AOCBDKLV.js +0 -1
- package/dist/ui/chunk-DUJYIOLE.js +0 -5
- package/dist/ui/chunk-IDYKCAAL.js +0 -1
- package/dist/ui/chunk-IKED2IGU.js +0 -1
- package/dist/ui/chunk-J3EGGI57.js +0 -1
- package/dist/ui/chunk-MZP6RIG2.js +0 -1
- package/dist/ui/chunk-NQ5ARARP.js +0 -1
- package/dist/ui/chunk-RI2JWWU3.js +0 -141
- package/dist/ui/chunk-RPOP6MVJ.js +0 -1
- package/dist/ui/chunk-TDKVKTW4.js +0 -1
- package/dist/ui/chunk-TZEZEMRQ.js +0 -1
- package/dist/ui/chunk-UA7UCTX5.js +0 -1
- package/dist/ui/chunk-UFQSZ6J2.js +0 -3
- package/dist/ui/gcs-L33FIRZU.js +0 -1
- /package/dist/ui/{ImageEditorDialog-QEULJAT2.js.LEGAL.txt → ImageEditorDialog-GGS4VFEA.js.LEGAL.txt} +0 -0
- /package/dist/ui/{chunk-RI2JWWU3.js.LEGAL.txt → chunk-4ALFT4ES.js.LEGAL.txt} +0 -0
- /package/dist/ui/{chunk-SKEP5WYH.js.LEGAL.txt → chunk-7SK47HHZ.js.LEGAL.txt} +0 -0
- /package/dist/ui/{chunk-NMBXHKIJ.js.LEGAL.txt → chunk-NJMNOITA.js.LEGAL.txt} +0 -0
- /package/dist/ui/{chunk-EGEB6N4J.js.LEGAL.txt → chunk-VD6G5NV4.js.LEGAL.txt} +0 -0
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
import{c as mE,e as IE}from"./chunk-3XYCOR6Z.js";import{a as EE,b as wE}from"./chunk-TZEZEMRQ.js";import{a as yE}from"./chunk-DXKEDMEI.js";import{a as _E,b as bE,c as _h}from"./chunk-SEUH7LN2.js";import{a as Rd}from"./chunk-T47V6AGW.js";import{a as OE}from"./chunk-HYARD7BK.js";import{a as dE,d as pE}from"./chunk-6E7PGMZX.js";import{a as aE}from"./chunk-N4DFAIC5.js";import{c as mh}from"./chunk-NMBXHKIJ.js";import{b as lE,d as cE}from"./chunk-344GZOGG.js";import{a as TE,b as pr,c as Zs,d as SE,e as $d,f as Hn,g as kE,i as Fo,j as en,l as zd}from"./chunk-MZP6RIG2.js";import{a as Pd}from"./chunk-V7RAXP2W.js";import{a as ur}from"./chunk-6GPTGBA7.js";import{f as Js,j as uE}from"./chunk-SKEP5WYH.js";import{a as vC,d as xE,e as vE,h as DE}from"./chunk-OVRTVMO5.js";import{g as hE,h as Xs,i as gE}from"./chunk-IKED2IGU.js";import{c as yC,d as xC,f as _d}from"./chunk-4IXGYXA2.js";import{a as fE}from"./chunk-NQB37NMX.js";import{a as Bd,b as CE,c as NE}from"./chunk-TDKVKTW4.js";import{a as Fd}from"./chunk-D37DCENS.js";import{a as Mt,c as at}from"./chunk-KPJ53X55.js";import{a as Us,b as js,c as ud,d as aC}from"./chunk-W3HIZQ4Z.js";import{c as oC}from"./chunk-JDW4UORS.js";import{A as _C,D as gd,E as md,a as pd,b as Cl,e as dC,g as uC,p as pC,q as fC,t as Vs,v as hC,x as gC,y as hd,z as mC}from"./chunk-NQ5ARARP.js";import{b as fd,e as ah,f as dr,h as lC,i as cC}from"./chunk-UFQSZ6J2.js";import{a as ih,b as cr}from"./chunk-CVGYBXVH.js";import{a as ve,b as yt,c as Jv}from"./chunk-AXETBZ6T.js";import{a as Ui}from"./chunk-N5Y5OWTV.js";import{a as sh,d as rC,e as iC,f as sC}from"./chunk-ORXEMIQC.js";import{a as Ws,b as Po,e as Ze,g as bC}from"./chunk-5MV6XVGA.js";import{a as dd,c as Xv,e as Zv,p as Qv,q as eC,r as tC,u as rh}from"./chunk-EGEB6N4J.js";import{d as nC,f as Se}from"./chunk-RPOP6MVJ.js";import{$a as TC,Ac as oE,Ba as qr,Bb as LC,Bc as rE,Dc as qs,Ea as cd,Eb as RC,Fa as De,Fb as Ed,Fc as iE,Ga as g,Gb as PC,Gc as Od,Hb as FC,Hc as Id,Ia as lh,Ib as BC,Ic as Md,Ja as CC,Jb as $C,Jc as Ad,Kb as zC,Ma as Jr,Nb as uh,Nc as El,Ob as wd,Oc as ho,Pb as HC,Pc as Ld,Qa as Gs,Qb as KC,Rb as Hi,Sb as UC,Ta as bd,Tb as jC,Tc as gh,U as oh,Ua as ch,V as Qt,Va as EC,W as Pe,Wb as Td,Xa as wC,Xb as VC,Xc as sE,Y as sr,Yb as WC,Za as zi,Zb as GC,_ as Ks,_a as to,_b as Sd,a as R,aa as Vv,ab as SC,ac as YC,b as $v,bb as kC,c as P,cb as NC,cc as qC,d as un,da as ee,db as yd,e as Y,ea as Ao,eb as dh,fa as ar,g as J,gb as xd,h as we,hc as JC,i as It,ic as ph,j as ke,jb as vd,jc as kd,k as zv,l as Hv,la as sd,lb as DC,m as $i,mc as XC,na as Lo,nc as ZC,o as Kv,oa as ad,pa as Wv,pc as QC,q as Yr,qa as X,qb as OC,qc as eE,r as Uv,ra as ld,rc as tE,s as jv,sa as Gv,tb as Cd,u as vl,ua as lr,uc as Ki,v as et,va as Yv,vc as fh,w as Hs,wb as Ys,wc as Nd,x as th,xb as IC,xc as hh,y as pt,ya as qv,yb as MC,yc as nE,z as nh,za as Ro,zb as AC,zc as Dd}from"./chunk-4CUWZQXT.js";import{b as Bi,d as Me,e as Bv,j as Ot,k as zs}from"./chunk-KUCVLANF.js";import{b as Qf,c as Re,d as eh,e as YL}from"./chunk-PVAE643M.js";var n0=Qf(t0=>{"use strict";var wl=(pt(),YL(th));function kR(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var NR=typeof Object.is=="function"?Object.is:kR,DR=wl.useSyncExternalStore,OR=wl.useRef,IR=wl.useEffect,MR=wl.useMemo,AR=wl.useDebugValue;t0.useSyncExternalStoreWithSelector=function(t,e,n,o,r){var i=OR(null);if(i.current===null){var s={hasValue:!1,value:null};i.current=s}else s=i.current;i=MR(function(){function l(f){if(!c){if(c=!0,d=f,f=o(f),r!==void 0&&s.hasValue){var h=s.value;if(r(h,f))return u=h}return u=f}if(h=u,NR(d,f))return h;var m=o(f);return r!==void 0&&r(h,m)?(d=f,h):(d=f,u=m)}var c=!1,d,u,p=n===void 0?null:n;return[function(){return l(e())},p===null?void 0:function(){return l(p())}]},[e,n,o,r]);var a=DR(t,i[0],i[1]);return IR(function(){s.hasValue=!0,s.value=a},[a]),AR(a),a}});var r0=Qf((N9,o0)=>{"use strict";o0.exports=n0()});var mv=Qf((fse,Hf)=>{"use strict";var oV=typeof window<"u"?window:typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?self:{};var oe=(function(t){var e=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,n=0,o={},r={manual:t.Prism&&t.Prism.manual,disableWorkerMessageHandler:t.Prism&&t.Prism.disableWorkerMessageHandler,util:{encode:function m(_){return _ instanceof i?new i(_.type,m(_.content),_.alias):Array.isArray(_)?_.map(m):_.replace(/&/g,"&").replace(/</g,"<").replace(/\u00a0/g," ")},type:function(m){return Object.prototype.toString.call(m).slice(8,-1)},objId:function(m){return m.__id||Object.defineProperty(m,"__id",{value:++n}),m.__id},clone:function m(_,b){b=b||{};var y,x;switch(r.util.type(_)){case"Object":if(x=r.util.objId(_),b[x])return b[x];y={},b[x]=y;for(var v in _)_.hasOwnProperty(v)&&(y[v]=m(_[v],b));return y;case"Array":return x=r.util.objId(_),b[x]?b[x]:(y=[],b[x]=y,_.forEach(function(E,C){y[C]=m(E,b)}),y);default:return _}},getLanguage:function(m){for(;m;){var _=e.exec(m.className);if(_)return _[1].toLowerCase();m=m.parentElement}return"none"},setLanguage:function(m,_){m.className=m.className.replace(RegExp(e,"gi"),""),m.classList.add("language-"+_)},currentScript:function(){if(typeof document>"u")return null;if(document.currentScript&&document.currentScript.tagName==="SCRIPT")return document.currentScript;try{throw new Error}catch(y){var m=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(y.stack)||[])[1];if(m){var _=document.getElementsByTagName("script");for(var b in _)if(_[b].src==m)return _[b]}return null}},isActive:function(m,_,b){for(var y="no-"+_;m;){var x=m.classList;if(x.contains(_))return!0;if(x.contains(y))return!1;m=m.parentElement}return!!b}},languages:{plain:o,plaintext:o,text:o,txt:o,extend:function(m,_){var b=r.util.clone(r.languages[m]);for(var y in _)b[y]=_[y];return b},insertBefore:function(m,_,b,y){y=y||r.languages;var x=y[m],v={};for(var E in x)if(x.hasOwnProperty(E)){if(E==_)for(var C in b)b.hasOwnProperty(C)&&(v[C]=b[C]);b.hasOwnProperty(E)||(v[E]=x[E])}var k=y[m];return y[m]=v,r.languages.DFS(r.languages,function(T,w){w===k&&T!=m&&(this[T]=v)}),v},DFS:function m(_,b,y,x){x=x||{};var v=r.util.objId;for(var E in _)if(_.hasOwnProperty(E)){b.call(_,E,_[E],y||E);var C=_[E],k=r.util.type(C);k==="Object"&&!x[v(C)]?(x[v(C)]=!0,m(C,b,null,x)):k==="Array"&&!x[v(C)]&&(x[v(C)]=!0,m(C,b,E,x))}}},plugins:{},highlightAll:function(m,_){r.highlightAllUnder(document,m,_)},highlightAllUnder:function(m,_,b){var y={callback:b,container:m,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};r.hooks.run("before-highlightall",y),y.elements=Array.prototype.slice.apply(y.container.querySelectorAll(y.selector)),r.hooks.run("before-all-elements-highlight",y);for(var x=0,v;v=y.elements[x++];)r.highlightElement(v,_===!0,y.callback)},highlightElement:function(m,_,b){var y=r.util.getLanguage(m),x=r.languages[y];r.util.setLanguage(m,y);var v=m.parentElement;v&&v.nodeName.toLowerCase()==="pre"&&r.util.setLanguage(v,y);var E=m.textContent,C={element:m,language:y,grammar:x,code:E};function k(w){C.highlightedCode=w,r.hooks.run("before-insert",C),C.element.innerHTML=C.highlightedCode,r.hooks.run("after-highlight",C),r.hooks.run("complete",C),b&&b.call(C.element)}if(r.hooks.run("before-sanity-check",C),v=C.element.parentElement,v&&v.nodeName.toLowerCase()==="pre"&&!v.hasAttribute("tabindex")&&v.setAttribute("tabindex","0"),!C.code){r.hooks.run("complete",C),b&&b.call(C.element);return}if(r.hooks.run("before-highlight",C),!C.grammar){k(r.util.encode(C.code));return}if(_&&t.Worker){var T=new Worker(r.filename);T.onmessage=function(w){k(w.data)},T.postMessage(JSON.stringify({language:C.language,code:C.code,immediateClose:!0}))}else k(r.highlight(C.code,C.grammar,C.language))},highlight:function(m,_,b){var y={code:m,grammar:_,language:b};if(r.hooks.run("before-tokenize",y),!y.grammar)throw new Error('The language "'+y.language+'" has no grammar.');return y.tokens=r.tokenize(y.code,y.grammar),r.hooks.run("after-tokenize",y),i.stringify(r.util.encode(y.tokens),y.language)},tokenize:function(m,_){var b=_.rest;if(b){for(var y in b)_[y]=b[y];delete _.rest}var x=new l;return c(x,x.head,m),a(m,x,_,x.head,0),u(x)},hooks:{all:{},add:function(m,_){var b=r.hooks.all;b[m]=b[m]||[],b[m].push(_)},run:function(m,_){var b=r.hooks.all[m];if(!(!b||!b.length))for(var y=0,x;x=b[y++];)x(_)}},Token:i};t.Prism=r;function i(m,_,b,y){this.type=m,this.content=_,this.alias=b,this.length=(y||"").length|0}i.stringify=function m(_,b){if(typeof _=="string")return _;if(Array.isArray(_)){var y="";return _.forEach(function(k){y+=m(k,b)}),y}var x={type:_.type,content:m(_.content,b),tag:"span",classes:["token",_.type],attributes:{},language:b},v=_.alias;v&&(Array.isArray(v)?Array.prototype.push.apply(x.classes,v):x.classes.push(v)),r.hooks.run("wrap",x);var E="";for(var C in x.attributes)E+=" "+C+'="'+(x.attributes[C]||"").replace(/"/g,""")+'"';return"<"+x.tag+' class="'+x.classes.join(" ")+'"'+E+">"+x.content+"</"+x.tag+">"};function s(m,_,b,y){m.lastIndex=_;var x=m.exec(b);if(x&&y&&x[1]){var v=x[1].length;x.index+=v,x[0]=x[0].slice(v)}return x}function a(m,_,b,y,x,v){for(var E in b)if(!(!b.hasOwnProperty(E)||!b[E])){var C=b[E];C=Array.isArray(C)?C:[C];for(var k=0;k<C.length;++k){if(v&&v.cause==E+","+k)return;var T=C[k],w=T.inside,S=!!T.lookbehind,N=!!T.greedy,D=T.alias;if(N&&!T.pattern.global){var O=T.pattern.toString().match(/[imsuy]*$/)[0];T.pattern=RegExp(T.pattern.source,O+"g")}for(var M=T.pattern||T,I=y.next,L=x;I!==_.tail&&!(v&&L>=v.reach);L+=I.value.length,I=I.next){var K=I.value;if(_.length>m.length)return;if(!(K instanceof i)){var W=1,q;if(N){if(q=s(M,L,m,S),!q||q.index>=m.length)break;var _t=q.index,B=q.index+q[0].length,se=L;for(se+=I.value.length;_t>=se;)I=I.next,se+=I.value.length;if(se-=I.value.length,L=se,I.value instanceof i)continue;for(var me=I;me!==_.tail&&(se<B||typeof me.value=="string");me=me.next)W++,se+=me.value.length;W--,K=m.slice(L,se),q.index-=L}else if(q=s(M,0,K,S),!q)continue;var _t=q.index,Zt=q[0],ut=K.slice(0,_t),bt=K.slice(_t+Zt.length),sn=L+K.length;v&&sn>v.reach&&(v.reach=sn);var ye=I.prev;ut&&(ye=c(_,ye,ut),L+=ut.length),d(_,ye,W);var Xe=new i(E,w?r.tokenize(Zt,w):Zt,D,Zt);if(I=c(_,ye,Xe),bt&&c(_,I,bt),W>1){var st={cause:E+","+k,reach:sn};a(m,_,b,I.prev,L,st),v&&st.reach>v.reach&&(v.reach=st.reach)}}}}}}function l(){var m={value:null,prev:null,next:null},_={value:null,prev:m,next:null};m.next=_,this.head=m,this.tail=_,this.length=0}function c(m,_,b){var y=_.next,x={value:b,prev:_,next:y};return _.next=x,y.prev=x,m.length++,x}function d(m,_,b){for(var y=_.next,x=0;x<b&&y!==m.tail;x++)y=y.next;_.next=y,y.prev=_,m.length-=x}function u(m){for(var _=[],b=m.head.next;b!==m.tail;)_.push(b.value),b=b.next;return _}if(!t.document)return t.addEventListener&&(r.disableWorkerMessageHandler||t.addEventListener("message",function(m){var _=JSON.parse(m.data),b=_.language,y=_.code,x=_.immediateClose;t.postMessage(r.highlight(y,r.languages[b],b)),x&&t.close()},!1)),r;var p=r.util.currentScript();p&&(r.filename=p.src,p.hasAttribute("data-manual")&&(r.manual=!0));function f(){r.manual||r.highlightAll()}if(!r.manual){var h=document.readyState;h==="loading"||h==="interactive"&&p&&p.defer?document.addEventListener("DOMContentLoaded",f):window.requestAnimationFrame?window.requestAnimationFrame(f):window.setTimeout(f,16)}return r})(oV);typeof Hf<"u"&&Hf.exports&&(Hf.exports=oe);typeof global<"u"&&(global.Prism=oe);oe.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]};oe.languages.markup.tag.inside["attr-value"].inside.entity=oe.languages.markup.entity;oe.languages.markup.doctype.inside["internal-subset"].inside=oe.languages.markup;oe.hooks.add("wrap",function(t){t.type==="entity"&&(t.attributes.title=t.content.replace(/&/,"&"))});Object.defineProperty(oe.languages.markup.tag,"addInlined",{value:function(e,n){var o={};o["language-"+n]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:oe.languages[n]},o.cdata=/^<!\[CDATA\[|\]\]>$/i;var r={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:o}};r["language-"+n]={pattern:/[\s\S]+/,inside:oe.languages[n]};var i={};i[e]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return e}),"i"),lookbehind:!0,greedy:!0,inside:r},oe.languages.insertBefore("markup","cdata",i)}});Object.defineProperty(oe.languages.markup.tag,"addAttribute",{value:function(t,e){oe.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+t+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[e,"language-"+e],inside:oe.languages[e]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}});oe.languages.html=oe.languages.markup;oe.languages.mathml=oe.languages.markup;oe.languages.svg=oe.languages.markup;oe.languages.xml=oe.languages.extend("markup",{});oe.languages.ssml=oe.languages.xml;oe.languages.atom=oe.languages.xml;oe.languages.rss=oe.languages.xml;(function(t){var e=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;t.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+e.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+e.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+e.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+e.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:e,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},t.languages.css.atrule.inside.rest=t.languages.css;var n=t.languages.markup;n&&(n.tag.addInlined("style","css"),n.tag.addAttribute("style","css"))})(oe);oe.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/};oe.languages.javascript=oe.languages.extend("clike",{"class-name":[oe.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/});oe.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/;oe.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:oe.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:oe.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:oe.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:oe.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:oe.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/});oe.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:oe.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}});oe.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}});oe.languages.markup&&(oe.languages.markup.tag.addInlined("script","javascript"),oe.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript"));oe.languages.js=oe.languages.javascript;(function(){if(typeof oe>"u"||typeof document>"u")return;Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var t="Loading\u2026",e=function(p,f){return"\u2716 Error "+p+" while fetching file: "+f},n="\u2716 Error: File does not exist or is empty",o={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},r="data-src-status",i="loading",s="loaded",a="failed",l="pre[data-src]:not(["+r+'="'+s+'"]):not(['+r+'="'+i+'"])';function c(p,f,h){var m=new XMLHttpRequest;m.open("GET",p,!0),m.onreadystatechange=function(){m.readyState==4&&(m.status<400&&m.responseText?f(m.responseText):m.status>=400?h(e(m.status,m.statusText)):h(n))},m.send(null)}function d(p){var f=/^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(p||"");if(f){var h=Number(f[1]),m=f[2],_=f[3];return m?_?[h,Number(_)]:[h,void 0]:[h,h]}}oe.hooks.add("before-highlightall",function(p){p.selector+=", "+l}),oe.hooks.add("before-sanity-check",function(p){var f=p.element;if(f.matches(l)){p.code="",f.setAttribute(r,i);var h=f.appendChild(document.createElement("CODE"));h.textContent=t;var m=f.getAttribute("data-src"),_=p.language;if(_==="none"){var b=(/\.(\w+)$/.exec(m)||[,"none"])[1];_=o[b]||b}oe.util.setLanguage(h,_),oe.util.setLanguage(f,_);var y=oe.plugins.autoloader;y&&y.loadLanguages(_),c(m,function(x){f.setAttribute(r,s);var v=d(f.getAttribute("data-range"));if(v){var E=x.split(/\r\n?|\n/g),C=v[0],k=v[1]==null?E.length:v[1];C<0&&(C+=E.length),C=Math.max(0,Math.min(C-1,E.length)),k<0&&(k+=E.length),k=Math.max(0,Math.min(k,E.length)),x=E.slice(C,k).join(`
|
|
2
|
-
`),f.hasAttribute("data-start")||f.setAttribute("data-start",String(C+1))}h.textContent=x,oe.highlightElement(h)},function(x){f.setAttribute(r,a),h.textContent=x})}}),oe.plugins.fileHighlight={highlight:function(f){for(var h=(f||document).querySelectorAll(l),m=0,_;_=h[m++];)oe.highlightElement(_)}};var u=!1;oe.fileHighlight=function(){u||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),u=!0),oe.plugins.fileHighlight.highlight.apply(this,arguments)}})()});ke();ke();ke();function Hd(t){return g(Ki,{className:t.className,size:t.size})}function RE(t){let[e,n]=R(null),[o,r]=R("");if(P(()=>{let a=!0;return fetch("/cms/api/ai.config",{credentials:"include"}).then(async l=>{let c=await l.json();a&&n(c)}).catch(l=>{a&&r(String(l))}),()=>{a=!1}},[]),!e&&!o)return g("div",{className:"AiEditModal__ChatPanel__loading",children:g(Qt,{size:"sm",color:"gray"})});if(!(!!e?.enabled&&(e.models?.length||0)>0))return g("div",{className:"AiEditModal__ChatPanel__notConfigured",children:[g("div",{className:"AiEditModal__ChatPanel__notConfigured__icon",children:g(Ki,{size:32})}),g("div",{className:"AiEditModal__ChatPanel__notConfigured__title",children:"Root AI is not configured for this project."}),g("div",{className:"AiEditModal__ChatPanel__notConfigured__body",children:["Add an ",g("code",{children:"ai.models"})," entry to ",g("code",{children:"cmsPlugin()"})," in"," ",g("code",{children:"root.config.ts"}),"."]}),o&&g("pre",{className:"AiEditModal__ChatPanel__notConfigured__error",children:o})]});let s=e.models.find(a=>a.id===e.defaultModel)||e.models[0];return g(qL,{model:s,editModeData:t.editModeData,onEditModeResponse:t.onEditModeResponse,welcome:t.children})}function qL(t){let e=Y(t.editModeData);e.current=t.editModeData;let n=J(()=>new lE({api:"/cms/api/ai.edit_object",credentials:"include",prepareSendMessagesRequest:({messages:p})=>({body:{messages:p,modelId:t.model.id,editData:e.current}})}),[t.model.id]),o=Y(t.onEditModeResponse);o.current=t.onEditModeResponse;let r=Y(new Map),{messages:i,sendMessage:s,status:a,error:l,stop:c,addToolOutput:d}=dE({transport:n,sendAutomaticallyWhen:cE,onToolCall:async({toolCall:p})=>{let f=await pE(p.toolName,p.input);d({tool:p.toolName,toolCallId:p.toolCallId,output:f})}}),u=a==="streaming"||a==="submitted";return P(()=>{let p=o.current;if(p)for(let f=i.length-1;f>=0;f--){let h=i[f];if(h.role!=="assistant")continue;let m=lR(h),_=cR(m);if(!_||r.current.get(h.id)===_)return;try{let y=JSON.parse(_);y&&typeof y=="object"&&(r.current.set(h.id,_),p({message:"",data:y}))}catch{}return}},[i]),g(Me,{children:[g(JL,{messages:i,isStreaming:u,welcome:t.welcome}),l&&g("div",{className:"AiEditModal__ChatPanel__error",children:[g("strong",{children:"Error:"})," ",l.message]}),g(nR,{canAttach:t.model.capabilities.attachments,isStreaming:u,onStop:c,onSend:(p,f)=>{if(!p&&f.length===0)return;let h=oR(f),m=[p,h.text].filter(Boolean).join(`
|
|
3
|
-
|
|
4
|
-
`);s({text:m,files:h.files.map(_=>({type:"file",mediaType:_.mediaType,url:_.url,filename:_.filename}))})}})]})}function JL(t){let e=Y(null);return P(()=>{let n=e.current;n&&(n.scrollTop=n.scrollHeight)},[t.messages]),t.messages.length===0?g("div",{className:"AiEditModal__ChatPanel__transcript AiEditModal__ChatPanel__transcript--empty",ref:e,children:g("div",{className:"AiEditModal__ChatPanel__welcome",children:[g("div",{className:"AiEditModal__ChatPanel__welcome__icon",children:g(Hd,{})}),g("div",{className:"AiEditModal__ChatPanel__welcome__title",children:"Edit with Root AI"}),t.welcome&&g("div",{className:"AiEditModal__ChatPanel__welcome__body",children:t.welcome})]})}):g("div",{className:"AiEditModal__ChatPanel__transcript",ref:e,children:g("div",{className:"AiEditModal__ChatPanel__transcript__inner",children:[t.messages.map(n=>g(XL,{message:n},n.id)),t.isStreaming&&g("div",{className:"AiEditModal__ChatPanel__streamingIndicator",children:[g(Qt,{size:"xs",color:"gray"}),g("span",{children:"Thinking\u2026"})]})]})})}function XL(t){let e=t.message,n=e.role==="user",o=n?"You":"Root AI",r=n?window.firebase.user?.photoURL:null;return g("div",{className:Se("AiEditModal__ChatPanel__message",`AiEditModal__ChatPanel__message--${e.role}`),children:[g("div",{className:"AiEditModal__ChatPanel__message__avatar",children:r?g("img",{src:r,alt:o}):g(Ki,{size:18})}),g("div",{className:"AiEditModal__ChatPanel__message__body",children:[g("div",{className:"AiEditModal__ChatPanel__message__username",children:o}),g("div",{className:"AiEditModal__ChatPanel__message__parts",children:(e.parts||[]).map((i,s)=>g(ZL,{part:i},s))})]})]})}function ZL(t){let e=t.part;if(e.type==="text"){if(!e.text)return null;let n=dR(e.text);return n?g("div",{className:"AiEditModal__ChatPanel__textPart",children:g(mh,{code:n})}):null}return e.type==="reasoning"?g(QL,{text:e.text}):e.type==="file"?g(eR,{part:e}):typeof e.type=="string"&&e.type.startsWith("tool-")?g(ME,{part:e}):e.type==="dynamic-tool"?g(ME,{part:e}):(e.type==="step-start",null)}function QL(t){let[e,n]=R(!1);return t.text?g("div",{className:Se("AiEditModal__ChatPanel__reasoning",e&&"AiEditModal__ChatPanel__reasoning--open"),children:[g("button",{type:"button",className:"AiEditModal__ChatPanel__reasoning__toggle",onClick:()=>n(!e),children:[g(to,{size:14,style:{transform:e?"rotate(0deg)":"rotate(-90deg)"}}),g("span",{children:"Thinking"})]}),e&&g("div",{className:"AiEditModal__ChatPanel__reasoning__body",children:g(mh,{code:t.text})})]}):null}function eR(t){let e=t.part;return e.mediaType?.startsWith("image/")?g("div",{className:"AiEditModal__ChatPanel__filePart",children:g("img",{src:e.url,alt:e.filename||"attachment"})}):g("a",{className:"AiEditModal__ChatPanel__filePart AiEditModal__ChatPanel__filePart--link",href:e.url,target:"_blank",children:[g(ph,{size:14}),g("span",{children:e.filename||e.url})]})}function ME(t){let e=t.part,n=typeof e.type=="string"&&e.type.startsWith("tool-")?e.type.slice(5):e.toolName||"tool",o=e.state||"",[r,i]=R(!1);return g("div",{className:"AiEditModal__ChatPanel__tool",children:[g("button",{type:"button",className:"AiEditModal__ChatPanel__tool__header",onClick:()=>i(!r),children:[g(El,{size:14}),g("code",{children:n}),g("span",{className:"AiEditModal__ChatPanel__tool__state",children:tR(o)}),g(to,{size:14,style:{marginLeft:"auto",transform:r?"rotate(0deg)":"rotate(-90deg)"}})]}),r&&g("div",{className:"AiEditModal__ChatPanel__tool__body",children:[e.input&&g("details",{open:!0,children:[g("summary",{children:"Input"}),g("pre",{children:JSON.stringify(e.input,null,2)})]}),e.output&&g("details",{open:!0,children:[g("summary",{children:"Output"}),g("pre",{children:JSON.stringify(e.output,null,2)})]}),e.errorText&&g("div",{className:"AiEditModal__ChatPanel__tool__error",children:e.errorText})]})]})}function tR(t){switch(t){case"input-streaming":return"preparing\u2026";case"input-available":return"running\u2026";case"output-available":return"done";case"output-error":return"error";default:return t}}function nR(t){let[e,n]=R(""),[o,r]=R([]),[i,s]=R(!1),a=Y(null),l=Y(null);P(()=>{window.requestAnimationFrame(()=>{let h=l.current;h&&(h.style.height="auto",h.style.height=`${Math.min(h.scrollHeight,200)}px`)})},[e,o]);let d=we(()=>{t.isStreaming||!e&&o.length===0||(t.onSend(e,o),n(""),r([]),a.current&&(a.current.value=""))},[e,o,t.isStreaming]),u=h=>{h.key==="Enter"&&!h.shiftKey&&(h.preventDefault(),d())},p=async h=>{s(!0);try{let m=h.type||aR(h.name),_=await iR(h,m),b=await Js(h,{disableGci:!0});r(y=>[...y,{url:b.src,filename:b.filename||h.name,mediaType:m,textContent:_?.text,textTruncated:_?.truncated,width:b.width,height:b.height}])}catch(m){console.error("upload failed",m)}finally{s(!1),a.current&&(a.current.value="")}},f=h=>{let m=h.target;Array.from(m.files||[]).forEach(p)};return g("div",{className:"AiEditModal__ChatPanel__composer",children:[g("div",{className:Se("AiEditModal__ChatPanel__composer__prompt",(i||o.length>0)&&"AiEditModal__ChatPanel__composer__prompt--hasImage"),children:[t.canAttach&&g("label",{className:"AiEditModal__ChatPanel__composer__imageUpload",children:[g("input",{ref:a,type:"file",className:"AiEditModal__ChatPanel__composer__imageUpload__input",onChange:f}),g(De,{label:"Upload file",children:g(Pe,{component:"div",className:"AiEditModal__ChatPanel__composer__imageUpload__icon",radius:"xl",children:g(ph,{size:18})})})]}),g("textarea",{ref:l,className:"AiEditModal__ChatPanel__composer__textInput",placeholder:"Tell me what you want to change...",value:e,rows:1,autofocus:!0,onKeyDown:u,onChange:h=>n(h.target.value),onPaste:h=>{let m=h.clipboardData?.items||[];for(let _ of m)if(_.kind==="file"){let b=_.getAsFile();b&&t.canAttach&&p(b)}}}),(i||o.length>0)&&g("div",{className:"AiEditModal__ChatPanel__composer__attachments",children:[i&&g(Qt,{size:"sm"}),o.map((h,m)=>g(De,{label:h.filename,transition:"pop",position:"top",withArrow:!0,children:g("button",{className:"AiEditModal__ChatPanel__composer__attachment",onClick:()=>r(_=>_.filter((b,y)=>y!==m)),children:[h.mediaType.startsWith("image/")?g("img",{src:h.url,alt:h.filename}):g("span",{className:"AiEditModal__ChatPanel__composer__attachment__name",children:h.filename}),g("div",{className:"AiEditModal__ChatPanel__composer__attachment__close",children:g(gh,{size:20,color:"white"})})]})},m))]}),t.isStreaming?g(Pe,{className:"AiEditModal__ChatPanel__composer__submit",variant:"filled",color:"dark",radius:"xl",onClick:t.onStop,title:"Stop",children:g(gh,{size:18})}):g(Pe,{className:"AiEditModal__ChatPanel__composer__submit",variant:"filled",color:"dark",radius:"xl",disabled:i||!e&&o.length===0,onClick:d,title:"Send",children:g(oE,{size:18})})]}),g("div",{className:"AiEditModal__ChatPanel__composer__disclaimer",children:"Root AI is experimental and makes mistakes. Check all info."})]})}var AE=1e5;function oR(t){let e=t.filter(LE),n=t.filter(o=>!LE(o)).map(rR);return{files:e,text:n.length?`Attached files:
|
|
5
|
-
|
|
6
|
-
${n.join(`
|
|
7
|
-
|
|
8
|
-
`)}`:""}}function LE(t){return t.mediaType.startsWith("image/")}function rR(t){let e=`File: ${t.filename} (${t.mediaType})`;if(t.textContent!==void 0){let n=t.textTruncated?`
|
|
9
|
-
|
|
10
|
-
[Content truncated before sending to the model.]`:"";return`${e}
|
|
11
|
-
URL: ${t.url}
|
|
12
|
-
|
|
13
|
-
~~~
|
|
14
|
-
${t.textContent}${n}
|
|
15
|
-
~~~`}return`${e}
|
|
16
|
-
URL: ${t.url}
|
|
17
|
-
|
|
18
|
-
[The file was uploaded, but its binary content was not inlined into this chat message.]`}async function iR(t,e){if(!sR(t.name,e))return null;let n=await t.text();return n.length<=AE?{text:n,truncated:!1}:{text:n.slice(0,AE),truncated:!0}}function sR(t,e){return e.startsWith("text/")?!0:[".css",".js",".jsx",".json",".md",".mdx",".mjs",".scss",".ts",".tsx",".txt",".yaml",".yml"].some(n=>t.toLowerCase().endsWith(n))}function aR(t){let e=t.toLowerCase();return e.endsWith(".png")?"image/png":e.endsWith(".webp")?"image/webp":e.endsWith(".jpg")||e.endsWith(".jpeg")?"image/jpeg":e.endsWith(".gif")?"image/gif":e.endsWith(".svg")?"image/svg+xml":e.endsWith(".pdf")?"application/pdf":e.endsWith(".json")?"application/json":e.endsWith(".csv")?"text/csv":e.endsWith(".md")?"text/markdown":e.endsWith(".txt")?"text/plain":"application/octet-stream"}function lR(t){return(t.parts||[]).filter(e=>e.type==="text"&&typeof e.text=="string").map(e=>e.text).join("")}function cR(t){if(!t)return null;let e=/```(?:json)?\s*\n([\s\S]*?)```/gi,n,o=null;for(;(n=e.exec(t))!==null;)o=n[1].trim();return o}function dR(t){if(!t)return t;let e=/```(?:json)?\s*\n[\s\S]*?```/gi,n=Array.from(t.matchAll(e)),o=t;if(n.length>0){let i=n[n.length-1],s=i.index??-1,a=s+i[0].length;s!==-1&&/^\s*$/.test(o.slice(a))&&(o=o.slice(0,s))}if((o.match(/```/g)||[]).length%2===1){let i=o.lastIndexOf("```");i!==-1&&(o=o.slice(0,i))}return o.trim()}var bh="AiEditModal";function PE(){let t=Mt(),e=at();return{open:n=>{t.openContextModal(bh,{...e,title:n.title||"Edit with AI (Experimental)",innerProps:n,size:"calc(min(1920px, calc(100% - 96px)))",centered:!0})},close:()=>{t.closeModal(bh)}}}function uR(t){let{innerProps:e,context:n,id:o}=t,r=Y(null),i=J(()=>JSON.stringify(e.data||{},null,2),[e.data]),[s,a]=R(i),l=J(()=>{if(!s)return null;try{return JSON.parse(s)}catch{return null}},[s]),c=J(()=>s!==i,[s,i]),d=we(()=>{if(!l)return;let p=md(l);e.onSave&&e.onSave(p)},[l]),u=we(p=>{if(p?.data){let f=JSON.stringify(p.data,null,2);a(f),r.current?.click()}},[]);return g("div",{className:"AiEditModal",children:[g("div",{className:"AiEditModal__SplitPanel",children:[g("div",{className:"AiEditModal__SplitPanel__ChatPanel",children:g(RE,{editModeData:l,onEditModeResponse:u,children:[g("p",{children:"Tell me what you want to change. I can make simple text edits, replace content within a module, or answer questions about the content."}),g("p",{children:"Just enter simple instructions, or attach a screenshot and ask me to use it as reference."})]})}),g("div",{className:"AiEditModal__SplitPanel__JsonPanel",children:g(cd,{className:"AiEditModal__Tabs",grow:!0,children:[g(cd.Tab,{label:"JSON",icon:g(HC,{size:20}),children:g("div",{className:"AiEditModal__JsonEditor",children:g(ad,{value:s,onChange:p=>a(p),formatOnBlur:!0,height:"100%",className:"AiEditModal__JsonInput"})})}),g(cd.Tab,{ref:r,label:"Diff",icon:g(IC,{size:20}),children:g("div",{className:"AiEditModal__JsonDiffViewer",children:e.data&&s&&g(aE,{oldCode:i,newCode:s})})})]})})]}),g("div",{className:"AiEditModal__buttons",children:[g(ee,{variant:"default",size:"xs",color:"dark",type:"button",onClick:()=>n.closeModal(o),children:"Cancel"}),g(ee,{variant:"default",size:"xs",type:"button",leftIcon:g(Jr,{size:16}),disabled:!c,onClick:()=>a(i),children:"Reset"}),g(ee,{leftIcon:g(zi,{size:16}),variant:"filled",size:"xs",color:"green",disabled:!l||!c,onClick:d,children:"Accept changes"})]})]})}uR.id=bh;ke();var yh="ComponentPickerModal",pR="root::ComponentPickerModal:layout",fR=3;function FE(){let t=Mt(),e=at();return{open:n=>{t.openContextModal(yh,{...e,innerProps:n,size:"720px",overflow:"inside",title:"Select a component"})},close:()=>{t.closeModal(yh)}}}function xh(t){let{innerProps:e}=t,[n,o]=R(""),[r,i]=fE(pR,"list"),[s,a]=R(0),l=Y(null),c=J(()=>{let f=n.trim().toLowerCase();return f?e.options.filter(h=>[h.schema.name,h.schema.label,h.schema.description,h.preset?.id,h.preset?.label,h.preset?.description].filter(Boolean).join(" ").toLowerCase().includes(f)):e.options},[e.options,n]);P(()=>{a(c.length>0?0:-1)},[c]),P(()=>{if(s<0||!l.current)return;l.current.querySelectorAll(".ComponentPickerModal__Card")[s]?.scrollIntoView({block:"nearest"})},[s]);function d(f){if(c.length===0)return;let h=r==="grid"?fR:1,m=c.length-1;if(f.key==="ArrowDown")f.preventDefault(),a(_=>Math.min(m,Math.max(0,_)+h));else if(f.key==="ArrowUp")f.preventDefault(),a(_=>Math.max(0,_-h));else if(f.key==="ArrowRight"&&r==="grid")f.preventDefault(),a(_=>Math.min(m,Math.max(0,_)+1));else if(f.key==="ArrowLeft"&&r==="grid")f.preventDefault(),a(_=>Math.max(0,_-1));else if(f.key==="Enter"&&s>=0){let _=c[s];_&&(f.preventDefault(),e.onSelect(_))}}let u=!!e.onRemove&&!n.trim();return g("div",{className:`ComponentPickerModal ${r==="grid"?"ComponentPickerModal--grid":"ComponentPickerModal--list"}`,onKeyDown:d,children:[g("div",{className:"ComponentPickerModal__controls",children:[g(lr,{"data-autofocus":!0,placeholder:e.searchPlaceholder||"Search components...",value:n,onChange:f=>o(f.target.value),icon:g(Dd,{size:16}),size:"xs",className:"ComponentPickerModal__controls__search"}),g(qv,{className:"ComponentPickerModal__controls__layout",size:"xs",value:r,onChange:f=>i(f),data:[{value:"list",label:g("span",{className:"ComponentPickerModal__controls__layout__option","aria-label":"List layout",title:"List layout",children:g(jC,{size:14})})},{value:"grid",label:g("span",{className:"ComponentPickerModal__controls__layout__option","aria-label":"Grid layout",title:"Grid layout",children:g(UC,{size:14})})}]})]}),c.length===0?g("div",{className:"ComponentPickerModal__empty",children:e.options.length===0?"No component types available.":"No components match your search."}):g("div",{className:"ComponentPickerModal__cards",ref:l,children:c.map((f,h)=>g(xh.Card,{option:f,layout:r,focused:h===s,onMouseEnter:()=>a(h),onSelect:()=>e.onSelect(f)},f.key))}),u&&g("div",{className:"ComponentPickerModal__footer",children:g(ee,{variant:"subtle",color:"red",size:"xs",leftIcon:g(ho,{size:14}),onClick:()=>e.onRemove?.(),children:"Clear selection"})})]})}xh.Card=t=>{let{schema:e,preset:n}=t.option,o=n?.label||n?.id||e.label||e.name,r=n?.description??e.description??"",i=n?.image||e.image,s=n?e.label||e.name:"",l=t.layout==="grid"?180:120,c=t.layout==="grid"?120:90,d=["ComponentPickerModal__Card",t.focused?"ComponentPickerModal__Card--focused":""].filter(Boolean).join(" ");return g("button",{type:"button",className:d,onClick:t.onSelect,onMouseEnter:t.onMouseEnter,children:[g("div",{className:"ComponentPickerModal__Card__image",children:g(sd,{src:i,width:l,height:c,withPlaceholder:!i,alt:o})}),g("div",{className:"ComponentPickerModal__Card__content",children:[s&&g("div",{className:"ComponentPickerModal__Card__content__subtitle",children:s}),g("div",{className:"ComponentPickerModal__Card__content__title",children:o}),r&&g("div",{className:"ComponentPickerModal__Card__content__description",children:r})]})]})};xh.id=yh;ke();var vh="EditJsonModal";function Ch(){let t=Mt(),e=at();return{open:n=>{t.openContextModal(vh,{...e,title:n.title||"Edit JSON",innerProps:n,size:"680px",centered:!0})},close:()=>{t.closeModal(vh)}}}function hR(t){let{innerProps:e,context:n,id:o}=t,r=JSON.stringify(e.data||{},null,2),[i,s]=R(r),[a,l]=R(!0),[c,d]=R(!1),[u,p]=R(!1);function f(_){s(_),d(!1);try{JSON.parse(_),l(!0)}catch{l(!1)}p(_!==r)}function h(){navigator.clipboard.writeText(i).then(()=>d(!0))}function m(){let _=JSON.parse(i),b=md(_);e.onSave&&e.onSave(b)}return g("div",{className:"EditJsonModal",children:[g(ad,{value:i,onChange:f,formatOnBlur:!0,autosize:!0,minRows:4,maxRows:25}),g("div",{className:"EditJsonModal__buttons",children:[g(ee,{variant:"default",size:"xs",color:"dark",type:"button",onClick:()=>n.closeModal(o),children:"Cancel"}),g(ee,{leftIcon:g(xd,{size:16}),variant:"filled",size:"xs",color:"dark",disabled:!a,type:"button",onClick:h,children:c?"Copied!":"Copy"}),g(ee,{variant:"default",size:"xs",type:"button",leftIcon:g(Jr,{size:16}),disabled:!u,onClick:()=>{s(r),l(!0),p(!1)},children:"Reset"}),g(ee,{leftIcon:g(OC,{size:16}),variant:"filled",size:"xs",color:"blue",disabled:!a||!u,onClick:m,children:"Save"})]})]})}hR.id=vh;ke();ke();function $E(t){let{docId:e,deepKey:n,translatable:o}=t,[r,i]=R(!0),[s,a]=R([]),l=new Intl.DateTimeFormat("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"});return P(()=>{async function c(){i(!0);let[d,u]=await Promise.all([hC(e),gC(e,"draft")]),p=d.versions,f=[];if(u){let m=Po(u,n);f.push({value:BE(m),modifiedBy:u.sys?.modifiedBy||"Unknown",modifiedAt:u.sys?.modifiedAt?.toDate?.()||new Date,versionId:"draft"})}for(let m of p){let _=Po(m,n);f.push({value:BE(_),modifiedBy:m.sys?.modifiedBy||"Unknown",modifiedAt:m.sys?.modifiedAt?.toDate?.()||new Date,versionId:m._versionId})}let h=[];for(let m of f){let _=h[h.length-1];(!_||_.value!==m.value)&&h.push(m)}a(h),i(!1)}c()},[e,n]),r?g("div",{className:"FieldHistory__loading",children:g(Qt,{size:"sm"})}):s.length===0?g("div",{className:"FieldHistory__empty",children:"No history available."}):g("div",{className:"FieldHistory",children:s.map((c,d)=>g("div",{className:"FieldHistory__entry",children:[g("div",{className:"FieldHistory__entry__header",children:[g("span",{className:"FieldHistory__entry__author",children:c.modifiedBy}),g("span",{className:"FieldHistory__entry__date",children:l.format(c.modifiedAt)}),d===0&&g("span",{className:"FieldHistory__entry__badge",children:"Current"}),o&&c.value&&g("span",{className:"FieldHistory__entry__translationsLink",children:g(gR,{value:c.value})})]}),g("div",{className:"FieldHistory__entry__value",children:c.value||g("span",{className:"FieldHistory__entry__empty",children:"(empty)"})})]},c.versionId))})}function gR(t){let[e,n]=R("");return P(()=>{dr(t.value).then(o=>{n(`/cms/translations/${o}`)})},[t.value]),e?g(De,{label:"Open in Translations Editor",withArrow:!0,position:"right",children:g(Pe,{component:"a",href:e,target:"_blank",variant:"transparent",size:"sm",children:g(Hi,{size:16})})}):null}function BE(t){return t==null?"":typeof t=="string"?t:JSON.stringify(t)}var Eh="EditTranslationsModal";function HE(){let t=Mt(),e=at();return{open:n=>{t.openContextModal(Eh,{...e,innerProps:n,size:"900px",title:"Edit translations",overflow:"inside",className:"EditTranslationsModalWrap"})},close:()=>{t.closeModal(Eh)}}}function wh(t){let{innerProps:e,context:n,id:o}=t,r=e.strings||[],s=(window.__ROOT_CTX.rootConfig.i18n||{}).locales||["en"],[a,l]=R({}),[c,d]=R([]),[u,p]=R(!1),[f,h]=R(!1),[m,_]=R(!0),[b,y]=R(!1),[x,v]=R(""),[E,C]=R(!1),[k,T]=R("translations"),w=e.draft||null;P(()=>{if(e.field?.deepKey&&w?.controller){let M=zE(e.field.deepKey),I=w.controller.getValue(M)||{};y(I.translate===!1),v(I.description||"")}},[e.field?.deepKey,w?.controller]),P(()=>{fd({tags:[e.docId]}).then(M=>{let I={};Object.values(M).forEach(L=>{I[L.source]=L}),l(I),_(!1)})},[e.docId]);async function S(){h(!0),await cr(async()=>{let M=`edit-translations-${e.docId}`;if(ve({id:M,loading:!0,title:"Saving translations",message:`Updating for ${e.docId}...`,autoClose:!1,disallowClose:!0}),e.field?.deepKey&&w?.controller){let I=zE(e.field.deepKey),L=w.controller.getValue(I)||{};b?L.translate=!1:delete L.translate,x?L.description=x:delete L.description,Object.keys(L).length>0?await w.controller.updateKey(I,L):await w.controller.removeKey(I),await w.controller.flush()}if(!b&&c.length>0){let I=[];c.forEach(L=>{let K=a[L];I.push(K)}),await Vs(e.docId,I)}yt({id:M,title:"Saved translations",message:`Updated translations for ${e.docId}!`,autoClose:!1})}),h(!1)}function N(M){l(I=>{let L={...I};return L[M.source]=M,L}),d(I=>{let L=new Set(I);return L.add(M.source),Array.from(L)}),p(!0)}async function D(){if(r.length!==0){C(!0);try{await cr(async()=>{for(let M of r){let I=a[M]||{source:M},L={};s.forEach(B=>{I[B]&&(L[B]=I[B])});let K=s.filter(B=>!I[B]);if(K.length===0)continue;let W=await window.fetch("/cms/api/ai.translate",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({sourceText:M,targetLocales:K,description:x||void 0,existingTranslations:L})});if(W.status!==200){let B=await W.text();throw new Error(`Translation failed: ${B}`)}let q=await W.json();if(q.success&&q.translations){let B={...I};Object.entries(q.translations).forEach(([se,me])=>{B[se]=me}),N(B)}}ve({message:"Finished generating AI translations",color:"green"})})}finally{C(!1)}}}function O(){if(!!!(window.__ROOT_CTX?.experiments||{}).ai)return!1;for(let L of r){let K=a[L]||{};for(let W of s)if(!K[W])return!0}return!1}return g("div",{className:"EditTranslationsModal",children:[m?g(Qt,{}):g(Me,{children:[e.field?.deepKey&&g("div",{className:"EditTranslationsModal__tabs",children:[g("button",{type:"button",className:Se("EditTranslationsModal__tabs__tab",k==="translations"&&"active"),onClick:()=>T("translations"),children:"Translations"}),g("button",{type:"button",className:Se("EditTranslationsModal__tabs__tab",k==="history"&&"active"),onClick:()=>T("history"),children:"History"})]}),k==="history"&&e.field?.deepKey?g($E,{docId:e.docId,deepKey:e.field.deepKey,translatable:!0}):g(Me,{children:[g("div",{className:"EditTranslationsModal__controls",children:[g("div",{className:"EditTranslationsModal__controls__doNotTranslate",children:[g(Ao,{label:"Do not translate",checked:b,onChange:M=>{y(M.currentTarget.checked),p(!0)},size:"sm"}),g(De,{label:"Prevent the string from being included for translation",withArrow:!0,position:"right",children:g(uh,{size:14,style:{marginLeft:"6px"}})})]}),g("div",{className:"EditTranslationsModal__controls__description",children:[g("div",{className:"EditTranslationsModal__controls__description__label",children:[g("span",{children:"Description"}),g(De,{label:"Translator notes may be included when the string is extracted and sent for translation",withArrow:!0,position:"right",children:g(uh,{size:14,style:{marginLeft:"6px"}})})]}),g(Lo,{size:"sm",autosize:!0,minRows:1,maxRows:6,value:x,placeholder:"Add context or notes for translators...",onChange:M=>{v(M.currentTarget.value),p(!0)}})]})]}),g("table",{className:"EditTranslationsModal__table",children:[g("thead",{style:{display:b?"none":"table-header-group"},children:g("tr",{children:[g("th",{children:g(ur,{size:"h4",weight:"semi-bold",children:"SOURCE"})}),g("th",{children:g("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[g(ur,{size:"h4",weight:"semi-bold",children:"TRANSLATIONS"}),O()&&g(De,{label:"Generate quick translations using AI",withArrow:!0,position:"left",children:g(Pe,{variant:"outline",onClick:D,loading:E,disabled:E,sx:{height:30,width:30,borderColor:"#ced4da"},children:E?g(Sd,{size:16}):g(qs,{size:16,fill:"currentColor",stroke:1.5})})})]})})]})}),g("tbody",{children:r.map(M=>g("tr",{style:{display:b?"none":"table-row"},children:[g("td",{children:g("div",{className:"EditTranslationsModal__table__source",children:M})}),g("td",{children:g(wh.StringsEditor,{source:M,locales:s,translations:a[M]||{},onChange:N})})]}))})]})]})]}),g("div",{className:"EditTranslationsModal__footer",children:[g("div",{className:"EditTranslationsModal__footer__left",children:[g(ee,{component:"a",href:`/cms/translations/${e.docId}`,target:"_blank",variant:"default",size:"xs",rightIcon:g(Ys,{size:14}),children:"Open Translations Editor"}),e.l10nSheet&&g("div",{className:"EditTranslationsModal__footer__gsheet",children:[g("strong",{children:"NOTE:"})," Translations for this doc are managed in"," ",g("a",{href:js(e.l10nSheet),target:"_blank",rel:"noopener noreferrer",children:"Google Sheets"})]})]}),g("div",{className:"EditTranslationsModal__footer__buttons",children:[g(ee,{variant:"default",size:"xs",color:"dark",type:"button",onClick:()=>n.closeModal(o),children:"Cancel"}),g(ee,{variant:"filled",size:"xs",color:"dark",onClick:()=>S(),disabled:!u,loading:f,children:"Save"})]})]})]})}wh.StringsEditor=t=>{let e=t.locales,[n,o]=R(t.translations||{}),[r,i]=R(!1);P(()=>{o(t.translations||{})},[t.translations]);function s(a,l){i(!0),o(c=>{let d={...c,source:t.source};return d[a]=l,d})}return P(()=>{r&&t.onChange(n)},[r,n]),g("div",{className:"EditTranslationsModal__StringsEditor",children:e.map(a=>g("div",{className:"EditTranslationsModal__StringsEditor__row",children:[g("div",{className:"EditTranslationsModal__StringsEditor__row__locale",children:a}),g("div",{className:Se("EditTranslationsModal__StringsEditor__row__translation",n[a]?"hasValue":"empty"),children:g(Lo,{size:"xs",radius:0,autosize:!0,minRows:1,maxRows:10,value:n[a],onChange:l=>{s(a,l.currentTarget.value)}})})]}))})};wh.id=Eh;function zE(t){let e=t.split("."),n=e.pop();return[...e,`@${n}`].join(".")}Hs();ke();var KE="ExportSheetModal";function UE(){let t=Mt(),e=at();return{open:n=>{t.openContextModal(KE,{...e,title:"Export to Google Sheet",innerProps:n,size:"650px"})}}}function Th(t){let{innerProps:e,context:n,id:o}=t,[r,i]=R(!1),[s,a]=R("new-sheet"),[l,c]=R(""),[d,u]=R(!1),p=Pd(),f=mE(),h=Y(),m=aC(f.settings.googleDriveFolder),_=[{value:"new-sheet",label:"Create Google Sheet",help:"Creates a new Google Sheet and exports strings to the sheet."},{value:"add-tab",label:"Add tab in Google Sheet",help:"Adds a new tab in an existing Google Sheet and exports strings to the sheet."},{value:"link-sheet",label:"Link Google Sheet",help:"Links an existing Google Sheet without exporting strings."}],b=!1;(s==="add-tab"||s==="link-sheet")&&(b=!0,l&&ud(l)?.spreadsheetId&&(b=!1));async function y(k,T){let w=T?.isNew||!1,{headers:S,rows:N}=e.csvData;w?(await k.replaceSheet(S,N),await k.applyL10nTheme()):await k.updateValuesMap(N,{keyedBy:"source",preserveColumns:e.locales})}async function x(){p.isLoggedIn()||await p.login();let k=window.__ROOT_CTX.rootConfig,T=k.projectName||k.projectId||"Root CMS",w,S,N="create-google-sheet";try{if(ve({id:N,loading:!0,title:"Creating Google Sheet...",message:"Creating Google Sheet for localization.",autoClose:!1,disallowClose:!0}),w=await Us.create({title:`${T} Localization`,parent:m,share:h.current?.checked}),S=await w.getSheet(0),!S)throw new Error("could not find sheet gid=0");S.setTitle(e.docId)}catch(D){console.error(D);let O=D;typeof D=="object"&&D.body&&(O=String(D.body)),yt({id:N,title:"Failed to create Google Sheet",message:String(O),color:"red",autoClose:!1});return}try{yt({id:N,loading:!0,title:"Created Google Sheet!",message:`Linking sheet to ${e.docId}...`,autoClose:!1,disallowClose:!0});let D={spreadsheetId:w.spreadsheetId,gid:0};await hd(e.docId,D)}catch(D){console.error(D),yt({id:N,title:"Failed to link Google Sheet",message:String(D),color:"red",autoClose:!1});return}try{yt({id:N,loading:!0,title:"Linked Google Sheet!",message:"Exporting strings to sheet...",autoClose:!1,disallowClose:!0}),await y(S,{isNew:!0})}catch(D){console.error(D);let O=D;typeof D=="object"&&D.body&&(O=String(D.body)),yt({id:N,title:"Failed to export strings to Google Sheet",message:O,color:"red",autoClose:!1});return}c(S.getUrl()),u(!0),yt({id:N,title:"Done! Exported strings to Google Sheet.",message:w.getUrl(),autoClose:!1})}async function v(){p.isLoggedIn()||await p.login();let k=ud(l);if(!k?.spreadsheetId)throw new Error("failed to parse spreadsheet id");let T=new Us(k.spreadsheetId),w,S="add-tab-google-sheet";try{ve({id:S,loading:!0,title:"Creating tab in Google Sheet...",message:"Adding tab in existing Google Sheet",autoClose:!1,disallowClose:!0}),w=await T.createSheet({title:e.docId})}catch(N){console.error(N);let D=N;typeof N=="object"&&N.body&&(D=String(N.body)),yt({id:S,title:"Failed to create Google Sheet",message:String(D),color:"red",autoClose:!1});return}try{yt({id:S,loading:!0,title:"Created Google Sheet!",message:`Linking sheet to ${e.docId}...`,autoClose:!1,disallowClose:!0});let N={spreadsheetId:T.spreadsheetId,gid:w.gid};await hd(e.docId,N)}catch(N){console.error(N),yt({id:S,title:"Failed to link Google Sheet",message:String(N),color:"red",autoClose:!1});return}try{yt({id:S,loading:!0,title:"Linked Google Sheet!",message:"Exporting strings to sheet...",autoClose:!1,disallowClose:!0}),await y(w,{isNew:!0})}catch(N){console.error(N);let D=N;typeof N=="object"&&N.body&&(D=String(N.body)),yt({id:S,title:"Failed to export strings to Google Sheet",message:D,color:"red",autoClose:!1});return}u(!0),yt({id:S,title:"Done! Exported strings to Google Sheet.",message:w.getUrl(),autoClose:!1})}async function E(){let k="link-google-sheet",T=ud(l);if(!T?.spreadsheetId)throw new Error("failed to parse spreadsheet id");try{ve({id:k,loading:!0,title:"Link Google Sheet",message:`Linking sheet to ${e.docId}...`,autoClose:!1,disallowClose:!0}),await hd(e.docId,T)}catch(w){console.error(w),yt({id:k,title:"Failed to link Google Sheet",message:String(w),color:"red",autoClose:!1});return}u(!0),yt({id:k,title:`Done! Linked ${e.docId} to Google Sheet.`,message:js(T),autoClose:!1})}async function C(){console.log(s),i(!0),s==="new-sheet"?await cr(x):s==="add-tab"?await cr(v):s==="link-sheet"&&await cr(E),i(!1)}return g("div",{className:"ExportSheetModal",children:g("div",{className:"ExportSheetModal__content",children:[g("div",{className:"ExportSheetModal__content__body",children:"Export strings to Google Sheet or link an existing Google Sheet for managing translations."}),g("form",{className:"ExportSheetModal__form",children:[g("div",{className:"ExportSheetModal__form__section",children:[g("div",{className:"ExportSheetModal__form__description",children:"Export options:"}),g(Ro,{disabled:d||r,itemComponent:Th.SelectItem,data:_,onChange:k=>{a(k),k==="new-sheet"&&c("")},value:s})]}),g("div",{className:"ExportSheetModal__form__section",children:[g("div",{className:"ExportSheetModal__form__description",children:"Google Sheet URL:"}),s==="new-sheet"?g(lr,{disabled:!0,placeholder:f.settings.googleDriveFolder?"A new Google Sheet will be created in the project's Google Drive folder.":'A new Google Sheet will be created in your "My Drive" folder.'}):g(lr,{placeholder:"https://docs.google.com/spreadsheets/d/...",value:l,disabled:d||r,onChange:k=>c(k.currentTarget.value)})]}),s==="new-sheet"&&g("div",{className:"ExportSheetModal__form__section",children:g(De,{label:"Whether to share the Google Sheet with Admins and Editors upon creation. If your site has a Google Drive folder configured, the sheet will be created within it and inherit its permissions.",wrapLines:!0,width:320,withArrow:!0,position:"bottom",children:g(Ao,{disabled:d||r,ref:h,name:"share",value:"true",label:"Share Google Sheet with collaborators",defaultChecked:!m})})}),g("div",{className:"ExportSheetModal__form__buttons",children:d?g(Me,{children:[g(ee,{component:"a",target:"_blank",rel:"noopener noreferrer",href:l,variant:"default",size:"xs",color:"dark",rightIcon:g(Ys,{size:16}),children:"Open Google Sheet"}),g(ee,{variant:"filled",onClick:()=>n.closeModal(o),type:"button",size:"xs",color:"primary",children:"Done"})]}):g(Me,{children:[g(ee,{variant:"outline",onClick:()=>n.closeModal(o),type:"button",size:"xs",color:"dark",children:"Cancel"}),g(ee,{variant:"filled",size:"xs",color:"primary",loading:r,disabled:b,onClick:()=>C(),children:s==="link-sheet"?"Link Google Sheet":"Export to Google Sheet"})]})})]})]})})}Th.SelectItem=$i(t=>{let{label:e,help:n,...o}=t;return g("div",{className:"ExportSheetModal__SelectItem",...o,children:[g(Ui,{className:"ExportSheetModal__SelectItem__label",size:"body",children:e}),g(Ui,{className:"ExportSheetModal__SelectItem__help",size:"body-sm",children:n})]})});Th.id=KE;ke();ke();function jE(t){let{labels:e}=t,[n,o]=R(0);return P(()=>{let r=setTimeout(()=>{o(i=>(i+1)%e.length)},2e3);return()=>clearTimeout(r)},[n,e.length]),g("div",{className:"ProgressiveLoader",children:[g(Qt,{color:"gray",size:"md"}),g("div",{className:"ProgressiveLoader__labels",children:g(sr,{size:"sm",color:"dimmed",className:"ProgressiveLoader__label--entering",children:e[n]},n)})]})}var VE="LocalizationModal";function WE(){let t=Mt(),e=at();return{open:n=>{let o=new URLSearchParams(window.location.search);o.set("modal","localization"),window.history.replaceState(null,"",`${window.location.pathname}?${o}`),t.openContextModal(VE,{...e,innerProps:n,size:"clamp(80%, 1024px, 1280px)",onClose:()=>{n.draft?.flush({quiet:!0});let r=new URLSearchParams(window.location.search);r.delete("modal");let i=r.toString()?`${window.location.pathname}?${r}`:window.location.pathname;window.history.replaceState(null,"",i)}})}}}function Bo(t){let e=t.innerProps;return g("div",{className:"LocalizationModal",children:g("div",{className:"LocalizationModal__layout",children:[g(Bo.ConfigLocales,{...e}),g(Bo.Translations,{...e})]})})}Bo.id=VE;Bo.ConfigLocales=t=>{let[e,n]=R(()=>t.draft?t.draft.getLocales():["en"]),o=window.__ROOT_CTX.rootConfig.i18n||{},r=o.locales||["en"],i=o.groups||{default:{label:"",locales:r}};function s(c){return e.filter(d=>(i[c].locales||[]).includes(d))}function a(c,d){let u=new Set(e),p=i[c].locales||[];for(let h of p)d.includes(h)?u.add(h):u.delete(h);let f=Array.from(u.values()).sort();l(f)}function l(c){n(c),t.draft.setLocales(c)}return g("div",{className:"LocalizationModal__locales",children:g(qr,{spacing:30,children:[g(ar,{children:[g(ur,{className:"LocalizationModal__iconTitle LocalizationModal__locales__title",size:"h2",children:[g(qC,{strokeWidth:1.5}),g("span",{children:"Locales"})]}),g(Bo.AllNoneButtons,{onAllClicked:()=>l(r),onNoneClicked:()=>l([])})]}),g(qr,{spacing:40,children:Object.keys(i).map(c=>{let d=i[c],u=s(c);return g(Bo.LocaleGroup,{group:d,groupEnabledLocales:u,allEnabledLocales:e,onChange:p=>a(c,p)})})})]})})};Bo.LocaleGroup=t=>{let e=t.groupEnabledLocales||[],n=t.group.locales||[],o=t.allEnabledLocales||[];function r(s){t.onChange&&t.onChange(s)}function i(s){let a=e.indexOf(s);a===-1?e.push(s):e.splice(a,1),r(e)}return g(qr,{spacing:16,children:[t.group.label&&g(ar,{position:"apart",children:[g(ur,{size:"h4",weight:"semi-bold",children:t.group.label}),g(Bo.AllNoneButtons,{onAllClicked:()=>r(n),onNoneClicked:()=>r([])})]}),g(ar,{children:n.map(s=>{let a=e.includes(s),l=o.length<=1&&a;return g(Ao,{value:s,checked:a,disabled:l,label:GE(s),onChange:()=>i(s),size:"xs"})})})]})};Bo.AllNoneButtons=t=>g(ar,{spacing:"8px",children:[g(ee,{className:"LocalizationModal__allNoneBtn",variant:"subtle",size:"xs",compact:!0,onClick:t.onAllClicked,children:"All"}),"/",g(ee,{className:"LocalizationModal__allNoneBtn",variant:"subtle",size:"xs",compact:!0,onClick:t.onNoneClicked,children:"None"})]});Bo.Translations=t=>{let[e,n]=R(!0),[o,r]=R([]),i=window.__ROOT_CTX.rootConfig.i18n?.locales||[],s=t.locale||i.find(H=>H!=="en")||"en",[a,l]=R(s),[c,d]=R(!1),[u,p]=R({}),f=J(()=>{if(!a)return{};let H={};return Object.values(u).forEach(ne=>{H[ne.source]=ne[a]||""}),H},[a,u]),h=Pd(),[m,_]=R(null),b=UE(),y=yE(),[x,v]=R(new Set),E=x.size,[C,k]=R({}),[T,w]=R(!1),[S,N]=R(!1),[D,O]=R(null),M=Y(!1),I=Y(null),L=Object.keys(C).length;function K(H,ne,pe){k(re=>{let _e={...re};_e[H]||(_e[H]={}),_e[H]={..._e[H],[ne]:pe};let He=f[H]||"";return pe===He&&(delete _e[H][ne],Object.keys(_e[H]).length===0&&delete _e[H]),_e})}async function W(){w(!0);try{let H=Object.entries(C).map(([re,_e])=>({source:re,locales:_e}));await cC(H,{tags:[t.docId]});let ne=await Promise.all(H.map(async re=>({hash:await dr(re.source),source:re.source,locales:re.locales}))),pe=[t.docId];p(re=>{let _e={...re};for(let{hash:He,source:wt,locales:Dt}of ne){let an=_e[He],Vr=an?.tags||[],Tn=Array.from(new Set([...Vr,...pe]));an?_e[He]={...an,...Dt,tags:Tn}:_e[He]={source:wt,...Dt,tags:Tn}}return _e}),k({}),ve({title:"Saved!",message:`Updated ${H.length} translation(s).`,autoClose:2500})}catch(H){console.error(H),ve({title:"Error saving translations",message:String(H),color:"red",autoClose:!1})}w(!1)}function q(){return!!!(window.__ROOT_CTX?.experiments||{}).ai||!a?!1:o.some(pe=>{let re=C[pe]?.[a];return re!==void 0?!re:!f[pe]})}function B(){M.current=!0,I.current?.abort()}async function se(){if(!(!a||o.length===0)){M.current=!1,N(!0);try{for(let H of o){if(M.current)break;if(C[H]?.[a]||f[H])continue;O(H);let pe=new AbortController;I.current=pe;let re={},_e=_t[H];_e&&i.forEach(Dt=>{_e[Dt]&&(re[Dt]=_e[Dt])});let He=await window.fetch("/cms/api/ai.translate",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({sourceText:H,targetLocales:[a],existingTranslations:re}),signal:pe.signal});if(He.status!==200){let Dt=await He.text();throw new Error(`Translation failed: ${Dt}`)}let wt=await He.json();wt.success&&wt.translations?.[a]&&K(H,a,wt.translations[a])}M.current?ve({message:"AI translation stopped",color:"yellow"}):ve({message:"Finished generating AI translations",color:"green"})}catch(H){H instanceof DOMException&&H.name==="AbortError"||(console.error(H),ve({title:"Error generating translations",message:String(H),color:"red"}))}finally{N(!1),O(null),M.current=!1,I.current=null}}}let me=Y(!1);P(()=>{if(e)return;if(!me.current){me.current=!0;return}let H=!1;async function ne(){let pe=[t.docId],re=await Promise.all(o.map(async He=>({source:He,hash:await dr(He)})));if(H)return;let _e=new Set;for(let{source:He,hash:wt}of re)if(u[wt]){let Dt=u[wt].tags||[];pe.every(Vr=>Dt.includes(Vr))||_e.add(He)}H||v(_e)}return ne(),()=>{H=!0}},[t.docId,o,u,e]);let _t=J(()=>{let H={};return Object.values(u).forEach(ne=>{H[ne.source]=ne}),H},[u]),Zt=i.map(H=>({value:H,label:GE(H)})),ut=J(()=>!a||o.length===0?0:o.filter(H=>{let ne=C[H]?.[a];return ne!==void 0?!ne:!f[H]}).length,[o,f,a,C]);P(()=>{n(!0),Promise.all([_E(t.docId),fd(),_C(t.docId)]).then(async([H,ne,pe])=>{let re=[t.docId],_e=await Promise.all(H.map(async wt=>({source:wt,hash:await dr(wt)}))),He=new Set;for(let{source:wt,hash:Dt}of _e)if(ne[Dt]){let an=ne[Dt].tags||[];re.every(Tn=>an.includes(Tn))||He.add(wt)}r(H),p(ne),_(pe),v(He),n(!1)}).catch(H=>{console.error("Failed to load translations:",H),n(!1),ve({title:"Error",message:String(H?.message||H),color:"red",autoClose:!1})})},[t.docId]);function bt(H,ne){let pe=_t[H];return pe&&pe[ne]||""}function sn(){let H=i.filter(re=>re!=="en"&&!lC(re)),ne=["source","en",...H],pe=[];return o.forEach(re=>{let _e={source:re,en:bt(re,"en")||re};H.forEach(He=>{_e[He]=bt(re,He)}),pe.push(_e)}),{headers:ne,rows:pe}}async function ye(){let{headers:H,rows:ne}=sn(),pe=await window.fetch("/cms/api/csv.download",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({headers:H,rows:ne})});if(pe.status!==200){console.error("csv.download failed:");let He=await pe.text();console.error(He)}let re=await pe.blob(),_e=window.URL.createObjectURL(re);window.location.assign(_e),window.URL.revokeObjectURL(_e)}async function Xe(){let H=document.createElement("input");H.type="file",H.accept=".csv",H.addEventListener("change",async()=>{let ne=H.files?.[0];if(ne){let pe=new FormData;pe.append("file",ne);try{let re=await fetch("/cms/api/csv.import",{method:"POST",body:pe});if(re.status!==200){let wt=await re.text();throw new Error(`RPCError: ${wt}`)}let _e=(await re.json()).data,He=await Vs(t.docId,_e);p(wt=>Sh(wt,He)),ve({title:"Saved!",message:`Imported translations for ${t.docId}.`,autoClose:5e3})}catch(re){console.error(re),ve({title:"Failed to import CSV",message:String(re),color:"red",autoClose:!1})}}}),H.click()}async function st(){if(h.isLoggedIn()||await h.login(),!m?.spreadsheetId)throw new Error("no sheet linked");let ne=await new Us(m.spreadsheetId).getSheet(m.gid??0);if(!ne)throw new Error(`sheet not found: ${JSON.stringify(m)}`);await _l(ne),ve({title:"Exported strings to Google Sheet",message:ne.getUrl(),autoClose:!1})}async function _l(H,ne){let pe=ne?.isNew||!1,{headers:re,rows:_e}=sn();pe?(await H.replaceSheet(re,_e),await H.applyL10nTheme()):await H.updateValuesMap(_e,{keyedBy:"source",preserveColumns:i}),sC("doc.export_to_sheet",{metadata:{docId:t.docId,sheetId:{spreadsheetId:H.spreadsheet.spreadsheetId,gid:H.gid}}})}async function $t(){if(h.isLoggedIn()||await h.login(),!m?.spreadsheetId)throw new Error("no sheet linked");let ne=await new Us(m.spreadsheetId).getSheet(m.gid??0);if(!ne)throw new Error(`sheet not found: ${JSON.stringify(m)}`);console.log("importing google sheet");let pe=await ne.getValuesMap(),re=await Vs(t.docId,pe);p(_e=>Sh(_e,re)),ve({title:"Saved!",message:`Imported translations for ${t.docId}.`,autoClose:5e3})}async function wn(){await mC(t.docId),_(null),ve({title:"Unlinked Google Sheet",message:`${t.docId} is no longer connected to a Google Sheet.`,autoClose:5e3})}async function bl(){n(!0);let H=[],ne=[t.docId];for(let pe of o){let re=await dr(pe);if(u[re]){let _e=u[re].tags||[],He=Array.from(new Set([..._e,...ne]));H.push({hash:re,tags:He})}}H.length>0?(await ah(H,{mode:"union"}),p(pe=>{let re={...pe};return H.forEach(({hash:_e,tags:He})=>{re[_e]&&(re[_e]={...re[_e],tags:He})}),re}),ve({title:"Tags Applied",message:`Applied tag "${t.docId}" to ${H.length} string(s).`,color:"green"})):ve({title:"No strings updated",message:"No existing translations found to tag.",color:"blue"}),n(!1)}async function ir(H){try{await H()}catch(ne){console.error(ne);let pe;typeof ne=="object"&&ne.body?pe=String(ne.body):pe=String(ne),ve({title:"Error",message:pe,color:"red",autoClose:!1})}}function eo(H){switch(H){case"EXPORT_DOWNLOAD_CSV":{ir(ye);return}case"EXPORT_GOOGLE_SHEET_LINKED":{ir(st);return}case"EXPORT_GOOGLE_SHEET_SHOW_OPTIONS":{b.open({docId:t.docId,csvData:sn(),locales:i});return}case"IMPORT_CSV":{ir(Xe);return}case"IMPORT_GOOGLE_SHEET_LINKED":{ir($t);return}case"UNLINK_GOOGLE_SHEET":{ir(wn);return}default:console.log("unhandled action: "+H)}}async function id(H,ne){let re=(window.__ROOT_CTX.translations||[]).find(_e=>_e.id===H)?.label||H;await ir(async()=>{let _e=ne==="export"?await bE(t.docId):null,He=o.map(an=>{let Vr={};i.forEach(zt=>{Vr[zt]=bt(an,zt)??""});let Tn=_e?.get(an)?.description;return{source:an,translations:Vr,...Tn?{description:Tn}:{}}}),wt=ne==="import"||ne==="export"?ne:(()=>{throw new Error("Invalid translations action")})(),Dt=`translations-${wt}-${H}`;ve({id:Dt,message:ne==="import"?`Importing from ${re}...`:`Exporting to ${re}...`,loading:!0,autoClose:!1,disallowClose:!0});try{let an=await window.fetch(`/cms/api/translations.${wt}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({serviceId:H,docId:t.docId,data:He})});if(!(an.headers.get("content-type")||"").includes("application/json"))throw new Error(`Unexpected response (${an.status}). Please reload the page and try again.`);let Tn=await an.json();if(!Tn.success)throw new Error(Tn.error||"Unknown error");if(ne==="import")if(Array.isArray(Tn.data)){let zt=Tn.data.map(Wr=>{let Mo={source:String(Wr?.source??"")},Gr=Wr?.translations;return Gr&&typeof Gr=="object"&&i.forEach($s=>{let xl=Gr[$s];xl!=null&&(Mo[$s]=String(xl))}),Mo}),yl=await Vs(t.docId,zt,{actionMetadata:{service:H,numStrings:zt.length,locales:i},actionLinks:[{label:"Open translations",url:`/cms/content/${t.docId}?modal=localization`}]});p(Wr=>Sh(Wr,yl));let Fi=[t.docId],Sn=[];for(let Wr of zt){let Mo=await dr(Wr.source),$s=u[Mo]?.tags||[],xl=Array.from(new Set([...$s,...Fi]));Sn.push({hash:Mo,tags:xl})}Sn.length>0&&(await ah(Sn,{mode:"union"}),p(Wr=>{let Mo={...Wr};return Sn.forEach(({hash:Gr,tags:$s})=>{Mo[Gr]&&(Mo[Gr]={...Mo[Gr],tags:$s})}),Mo})),yt({id:Dt,title:"Imported!",message:`Imported translations from ${re}.`,loading:!1,autoClose:5e3})}else{let zt=Tn.data||{},yl=zt.title||"Import complete",Fi=zt.message||`Imported translations from ${re}.`,Sn=zt.link;yt({id:Dt,title:yl,color:zt.status==="success"?"green":zt.status==="error"?"red":void 0,message:Sn?.url?g("div",{children:[g("div",{children:Fi}),g(ee,{component:"a",href:Sn.url,target:"_blank",rel:"noopener noreferrer",size:"xs",variant:"default",rightIcon:g(Gs,{size:14}),style:{marginTop:"8px"},children:Sn.label||"Open"})]}):Fi,loading:!1,autoClose:Sn?.url?1e4:5e3})}else{let zt=Tn.data||{},yl=zt.title||"Exported!",Fi=zt.message||`Exported translations to ${re}.`,Sn=zt.link;yt({id:Dt,title:yl,color:zt.status==="success"?"green":zt.status==="error"?"red":void 0,message:Sn?.url?g("div",{children:[g("div",{children:Fi}),g(ee,{component:"a",href:Sn.url,target:"_blank",rel:"noopener noreferrer",size:"xs",variant:"default",rightIcon:g(Gs,{size:14}),style:{marginTop:"8px"},children:Sn.label||"Open"})]}):Fi,loading:!1,autoClose:Sn?.url?1e4:5e3})}}catch(an){throw Jv(Dt),an}})}return g("div",{className:"LocalizationModal__translations",children:[g("div",{className:"LocalizationModal__translations__topWrapper",children:[g("div",{className:"LocalizationModal__translations__header",children:[g("div",{className:"LocalizationModal__translations__titleWrap",children:g(ur,{className:"LocalizationModal__translations__title LocalizationModal__iconTitle",size:"h2",children:[g(Hi,{strokeWidth:1.5})," ",g("span",{children:"Translations"})]})}),g("div",{className:"LocalizationModal__translations__header__buttons",children:[h.enabled&&m?.spreadsheetId&&g(De,{label:"Open Google Sheet",children:g(Pe,{component:"a",href:js(m),target:"_blank",variant:"filled",color:"green",size:"sm",children:g(Ad,{size:16,strokeWidth:2.25})})}),g(ee,{component:"a",href:`/cms/translations/${t.docId}`,target:"_blank",variant:"default",size:"xs",rightIcon:g(Gs,{size:14,strokeWidth:1.75}),children:"Open Editor"}),g(_R,{onAction:eo,onServiceAction:id,gapiClient:h,linkedSheet:m}),g(bR,{onAction:eo,onServiceAction:id,gapiClient:h,linkedSheet:m}),g(X,{className:"LocalizationModal__translations__menu",control:g(De,{label:"Tools",children:g(Pe,{className:"LocalizationModal__translations__menu__dots",variant:"default",children:g(El,{size:16})})}),size:220,children:g(X.Item,{className:"LocalizationModal__translations__menu__item",icon:g(nE,{size:16}),onClick:()=>y.open({docId:t.docId,sourceStrings:o,onPruned:H=>{p(ne=>{let pe={...ne};return H.forEach(re=>delete pe[re]),pe})}}),children:"Prune unused strings"})})]})]}),e&&g(jE,{labels:["Transmogrifying...","Deciphering the vibes...","Consulting the Rosetta Stone...","Untangling the syntax...","Babel-ing..."]}),!e&&E>0&&g("div",{className:"LocalizationModal__missingTags",children:[g("div",{className:"LocalizationModal__missingTags__message",children:[g(lh,{}),E>1?g(sr,{size:"sm",children:[g("b",{children:[E," strings"]}),' are missing the "',t.docId,'" tag.']}):g(sr,{size:"sm",children:[g("b",{children:[E," string"]}),' is missing the "',t.docId,'" tag.']})]}),g(ee,{variant:"filled",size:"xs",onClick:()=>ir(bl),loading:e,leftIcon:g(El,{size:16}),children:"Fix missing tags"})]}),!e&&g("table",{className:"LocalizationModal__translations__table",children:[g("tr",{className:"LocalizationModal__translations__table__row LocalizationModal__translations__table__row--header",children:[g("th",{className:"LocalizationModal__translations__table__header",children:g(ur,{size:"h4",weight:"semi-bold",children:"SOURCE STRING"})}),g("th",{className:"LocalizationModal__translations__table__header",children:g("div",{className:"LocalizationModal__translations__localeHeader",children:[g(ur,{className:"LocalizationModal__translations__localeSelect",size:"h4",weight:"semi-bold",children:[g("span",{children:"LOCALE: "})," ",g(Ro,{data:Zt,size:"xs",placeholder:"select locale",allowDeselect:!0,value:a,onChange:H=>l(H)})]}),g("div",{style:{display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[a&&ut>0&&g(De,{label:c?"Show all translations":"Show only missing translations",position:"top",withArrow:!0,children:g("button",{className:`LocalizationModal__translations__missingToggle${c?" LocalizationModal__translations__missingToggle--active":""}`,onClick:()=>d(H=>!H),children:[g(LC,{size:14}),g("span",{children:[ut," missing"]})]})},c?"active":"inactive"),a&&o.length>0&&ut===0&&L===0&&g("div",{className:"LocalizationModal__translations__fullyTranslated",children:[g(zi,{size:14}),g("span",{children:"Translated"})]}),q()&&!S&&g(De,{label:"Generate translations using AI",withArrow:!0,position:"top",children:g(Pe,{variant:"default",size:"sm",onClick:se,children:g(qs,{size:14,fill:"black"})})}),S&&g(De,{label:"Stop generating",withArrow:!0,position:"top",children:g(Pe,{variant:"default",size:"sm",onClick:B,children:g(QC,{size:14,fill:"black"})})}),S&&g(Sd,{size:18,className:"LocalizationModal__spinner"})]})]})})]}),o.filter(H=>!c||!a?!0:!f[H]).map((H,ne)=>g("tr",{className:"LocalizationModal__translations__table__row",children:[g("td",{className:"LocalizationModal__translations__table__col",children:g("div",{className:"LocalizationModal__sourceCell",children:[g("span",{className:"LocalizationModal__sourceCell__text",children:H}),(_t[H]||x.has(H))&&g("div",{className:"LocalizationModal__sourceCell__icons",children:[_t[H]&&g(Pe,{className:"LocalizationModal__sourceCell__link",size:"sm",variant:"subtle",onClick:async()=>{let pe=await dr(H);window.open(`/cms/translations/${pe}`,"_blank")},children:g(Ys,{size:16})}),x.has(H)&&g(De,{label:`Missing "${t.docId}" tag`,position:"top",withArrow:!0,children:g(Pe,{className:"LocalizationModal__sourceCell__missingTag",size:"sm",variant:"subtle",children:g(lh,{size:14})})})]})]})}),g("td",{className:"LocalizationModal__translations__table__col",children:g(mR,{source:H,locale:a,savedValue:f[H]||"",pendingValue:C[H]?.[a],isAiGenerating:D===H,readOnly:S,onEdit:pe=>K(H,a,pe)})})]},ne))]})]}),g("div",{className:"LocalizationModal__translations__saveBar",children:[g("span",{className:"LocalizationModal__translations__saveBar__status",children:L>0?`${L} unsaved change${L!==1?"s":""}`:""}),L>0&&g(ee,{variant:"default",size:"xs",leftIcon:g(Jr,{size:14}),onClick:()=>k({}),children:"Discard changes"}),g(ee,{variant:"filled",size:"xs",color:"dark",leftIcon:g(zi,{size:14}),onClick:W,loading:T,disabled:L===0,children:"Save"})]})]})};function mR(t){let e=t.pendingValue!==void 0?t.pendingValue:t.savedValue,o=[t.pendingValue!==void 0?"LocalizationModal__translations__cell--edited":"",t.isAiGenerating?"LocalizationModal__translations__cell--ai-generating":"",e?"":"LocalizationModal__translations__cell--empty"].filter(Boolean).join(" ")||void 0;return g(Lo,{size:"xs",autosize:!0,minRows:1,value:e,placeholder:"",readOnly:t.readOnly,onChange:r=>t.onEdit(r.currentTarget.value),className:o,styles:{root:{height:"100%"},wrapper:{height:"100%"},input:{fontSize:"12px",minHeight:"100%"}}})}function _R(t){function e(r){t.onAction&&t.onAction(r)}let n=t.linkedSheet,o=(window.__ROOT_CTX.translations||[]).filter(r=>r.hasImport);return g(X,{className:"LocalizationModal__translations__menu",position:"bottom",placement:"end",control:g(ee,{variant:"default",color:"dark",size:"xs",leftIcon:g(AC,{size:16,strokeWidth:1.75}),rightIcon:g(to,{size:16,strokeWidth:1.75}),children:"Import"}),children:[t.gapiClient.enabled&&g(Me,{children:[g(X.Label,{children:"Google Sheets"}),g(X.Item,{className:"LocalizationModal__translations__menu__item",disabled:!n?.spreadsheetId,onClick:()=>e("IMPORT_GOOGLE_SHEET_LINKED"),children:"Import Google Sheet"}),g(Ks,{})]}),g(X.Label,{children:"File"}),g(X.Item,{className:"LocalizationModal__translations__menu__item",onClick:()=>e("IMPORT_CSV"),children:"Import .csv"}),o.length>0&&g(Me,{children:[g(Ks,{}),g(X.Label,{children:"Services"}),o.map(r=>g(X.Item,{className:"LocalizationModal__translations__menu__item",icon:r.icon?g("img",{src:r.icon,alt:r.label,style:{width:16,height:16}}):void 0,onClick:()=>t.onServiceAction?.(r.id,"import"),children:["Import from ",r.label]},r.id))]})]})}function bR(t){async function e(i){t.onAction&&t.onAction(i)}let o=!!t.linkedSheet?.spreadsheetId,r=(window.__ROOT_CTX.translations||[]).filter(i=>i.hasExport);return g(X,{className:"LocalizationModal__translations__menu",position:"bottom",placement:"start",control:g(ee,{variant:"default",color:"dark",size:"xs",leftIcon:g(MC,{size:16,strokeWidth:1.75}),rightIcon:g(to,{size:16,strokeWidth:1.75}),children:"Export"}),children:[t.gapiClient.enabled&&g(Me,{children:[g(X.Label,{children:"Google Sheets"}),o?g(Me,{children:g(X.Item,{className:"LocalizationModal__translations__menu__item",onClick:()=>e("EXPORT_GOOGLE_SHEET_LINKED"),children:"Export to Google Sheet"})}):g(Me,{children:g(X.Item,{className:"LocalizationModal__translations__menu__item",onClick:()=>e("EXPORT_GOOGLE_SHEET_SHOW_OPTIONS"),children:"Export to Google Sheet"})}),g(Ks,{})]}),g(X.Label,{children:"File"}),g(X.Item,{className:"LocalizationModal__translations__menu__item",onClick:()=>e("EXPORT_DOWNLOAD_CSV"),children:"Download .csv"}),r.length>0&&g(Me,{children:[g(Ks,{}),g(X.Label,{children:"Services"}),r.map(i=>g(X.Item,{className:"LocalizationModal__translations__menu__item",icon:i.icon?g("img",{src:i.icon,alt:i.label,style:{width:16,height:16}}):void 0,onClick:()=>t.onServiceAction?.(i.id,"export"),children:["Export to ",i.label]},i.id))]}),o&&g(Me,{children:[g(Ks,{}),g(X.Label,{children:"Danger zone"}),g(X.Item,{className:"LocalizationModal__translations__menu__item",onClick:()=>e("UNLINK_GOOGLE_SHEET"),color:"red",children:"Unlink Google Sheet"})]})]})}function Sh(t,e){let n={...t};for(let[o,r]of Object.entries(e)){let i=n[o];n[o]=i?{...i,...r}:r}return n}function GE(t){let e=t.split("_"),n=e[0];if(n==="ALL"){let i=String(e[1]).toUpperCase();return`${new Intl.DisplayNames(["en"],{type:"region"}).of(i)||t} (${t})`}return`${new Intl.DisplayNames(["en"],{type:"language"}).of(n)||t} (${t})`}ke();function YE(t){let e=new Set;return kh(t,e),Array.from(e)}function kh(t,e){if(!(!t||typeof t!="object")){if(Array.isArray(t)){for(let n of t)kh(n,e);return}if(yR(t)){e.add(t.id);return}for(let n of Object.keys(t))kh(t[n],e)}}function yR(t){return typeof t.id=="string"&&typeof t.collection=="string"&&typeof t.slug=="string"&&t.id.includes("/")}var qE="PublishDocModal";function JE(t){let e=Mt(),n=at();return{open:()=>{e.openContextModal(qE,{...n,title:`Publish ${t.docId}`,innerProps:t,size:"850px"})}}}function xR(t){let{innerProps:e,context:n,id:o}=t,[r,i]=R(""),[s,a]=R(""),[l,c]=R(!1),[d,u]=R(""),[p,f]=R(!1),h=Y(null),m=Mt(),_=at(),b=!!(window.__ROOT_CTX.ai||window.__ROOT_CTX.experiments?.ai),{roles:y,loading:x}=Fd(),v=window.firebase.user.email||"",E=Bd(y,v),C=r==="scheduled"?"Schedule":"Publish";async function k(){try{c(!0),await dC(e.docId,{publishMessage:d.trim()||void 0}),c(!1),ve({title:"Published!",message:`Succesfully published ${e.docId}.`,autoClose:1e4}),m.closeAll()}catch(D){console.error(D);let O=ih(D);ve({title:"Publish failed",message:`Failed to publish ${e.docId}: ${O}`,color:"red",autoClose:!1})}}async function T(){try{c(!0);let D=Math.floor(new Date(s).getTime());await uC(e.docId,D,{publishMessage:d.trim()||void 0}),c(!1),ve({title:"Scheduled!",message:`${e.docId} will go live ${s}.`,autoClose:1e4}),m.closeAll()}catch(D){console.error(D);let O=ih(D);ve({title:"Schedule failed",message:`Failed to schedule ${e.docId}: ${O}`,color:"red",autoClose:!1})}}async function w(){try{f(!0);let O=await(await window.fetch("/cms/api/ai.publish_message",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({docId:e.docId})})).json();O.success&&O.message?u(O.message):ve({title:"Generation failed",message:"Failed to generate publish message.",color:"red",autoClose:5e3})}catch(D){console.error(D),ve({title:"Generation failed",message:"Failed to generate publish message.",color:"red",autoClose:5e3})}finally{f(!1)}}function S(){m.openConfirmModal({..._,title:`${C} ${e.docId}`,children:g(Me,{children:[g(Ui,{size:"body-sm",weight:"semi-bold",className:"PublishDocModal__confirmText",children:["Are you sure you want to publish the following doc? The doc will go live ",r==="now"?"now":`at ${s}`,"."]}),g(xE,{docId:e.docId})]}),labels:{confirm:C,cancel:"Cancel"},cancelProps:{size:"xs"},confirmProps:{color:"dark",size:"xs"},onCancel:()=>console.log("Cancel"),closeOnConfirm:!0,onConfirm:()=>{r==="now"?k():r==="scheduled"&&T()}})}let N=!0;return(r==="now"||r==="scheduled"&&s)&&(N=!1),(x||!E)&&(N=!0),g("div",{className:"PublishDocModal",children:g("div",{className:"PublishDocModal__content",children:[g("form",{className:"PublishDocModal__form",onSubmit:D=>{D.preventDefault(),S()},children:[g("div",{className:"PublishDocModal__form__publishOptions",children:g("div",{className:"PublishDocModal__form__publishOptions__options",children:[g("label",{className:Se("PublishDocModal__form__publishOptions__option",r==="now"&&"PublishDocModal__form__publishOptions__option--selected",r&&r!=="now"&&"PublishDocModal__form__publishOptions__option--unselected"),children:[g("div",{className:"PublishDocModal__form__publishOptions__option__input",children:[g("input",{type:"radio",name:"publish-option",value:"now",checked:r==="now",onChange:()=>i("now")})," ","Now"]}),g("div",{className:"PublishDocModal__form__publishOptions__option__help",children:"Content will go live immediately."})]}),g("label",{className:Se("PublishDocModal__form__publishOptions__option",r==="scheduled"&&"PublishDocModal__form__publishOptions__option--selected",r&&r!=="scheduled"&&"PublishDocModal__form__publishOptions__option--unselected"),children:[g("div",{className:"PublishDocModal__form__publishOptions__option__input",children:[g("input",{type:"radio",name:"publish-option",value:"scheduled",checked:r==="scheduled",onChange:()=>i("scheduled")}),g("div",{children:"Scheduled"})]}),g("div",{className:"PublishDocModal__form__publishOptions__option__help",children:"Content will go live at the date and time specified below."}),g("div",{className:"PublishDocModal__form__publishOptions__option__input2",children:[g("input",{ref:h,type:"datetime-local",disabled:r!=="scheduled",value:s,min:iC(),onChange:D=>{let O=D.target;a(O.value)}}),g("div",{className:"PublishDocModal__form__publishOptions__option__input2__help",children:["timezone: ",Intl.DateTimeFormat().resolvedOptions().timeZone]})]})]})]})}),g("div",{className:"PublishDocModal__form__publishMessage",children:g("div",{className:"PublishDocModal__form__publishMessage__wrapper",children:[g("textarea",{className:"PublishDocModal__form__publishMessage__textarea",placeholder:"Optional: Add a message to describe the changes",value:d,rows:3,onInput:D=>{let O=D.target;u(O.value)}}),b&&g("button",{type:"button",className:"PublishDocModal__form__publishMessage__sparkle",onClick:w,disabled:p,children:g(De,{label:"Generate message",withArrow:!0,position:"left",allowPointerEvents:!0,wrapLines:!0,children:p?g(Qt,{size:16}):g(qs,{size:16,stroke:1.5})})})]})}),g("div",{className:"PublishDocModal__form__buttons",children:[g(ee,{variant:"outline",onClick:()=>n.closeModal(o),type:"button",size:"xs",color:"dark",children:"Cancel"}),g(ee,{variant:"filled",size:"xs",color:"dark",disabled:N,loading:l,type:"submit",children:C})]})]}),g("div",{className:"PublishDocModal__DiffWrapper",children:[g(ER,{docId:e.docId}),b&&g(EE,{docId:e.docId,beforeVersion:"published",afterVersion:"draft"}),g(vR,{docId:e.docId})]})]})})}function vR(t){let e=t.docId,[n,o]=R(!1);function r(){o(!0)}return g("div",{className:"PublishDocModal__ShowChanges",children:g(oh,{iconPosition:"right",onChange:()=>r(),disableIconRotation:!0,children:g(oh.Item,{label:"Compare JSON data",icon:g(RC,{stroke:1.5}),iconPosition:"left",children:n&&g(wE,{left:{docId:e,versionId:"published"},right:{docId:e,versionId:"draft"},showExpandButton:!0,showAiSummary:!1})})})})}function CR(t){let e=t?.sys;return e?!!(!e.publishedAt||e.modifiedAt&&e.modifiedAt>e.publishedAt):!1}function ER(t){let[e,n]=R(!0),[o,r]=R([]);P(()=>{async function a(){n(!0);try{let l=await Cl(t.docId);if(!l?.fields){n(!1);return}let c=YE(l.fields).filter(u=>u!==t.docId);if(c.length===0){n(!1);return}let d=[];await Promise.all(c.map(async u=>{try{let p=await Cl(u);p&&CR(p)&&d.push(u)}catch(p){console.warn(`Failed to fetch reference doc: ${u}`,p)}})),r(d.sort())}catch(l){console.error("Failed to load reference docs",l)}n(!1)}a()},[t.docId]);let i=[t.docId,...o],s=vC({docIds:i});return e?g("div",{className:"PublishDocModal__ReferenceDocs",children:g(Qt,{color:"gray",size:"sm"})}):o.length===0?null:g("div",{className:"PublishDocModal__ReferenceDocs",children:[g("div",{className:"PublishDocModal__ReferenceDocs__header",children:[g("div",{className:"PublishDocModal__ReferenceDocs__header__label",children:["Referenced docs with unpublished changes (",o.length,")"]}),g(ee,{variant:"outline",size:"xs",color:"dark",leftIcon:g(JC,{size:16}),onClick:()=>s.open(),children:"Bundle all docs into a release"})]}),g("div",{className:"PublishDocModal__ReferenceDocs__list",children:o.map(a=>g(_d,{docId:a,variant:"compact",statusBadges:!0,clickable:!0},a))})]})}xR.id=qE;pt();pt();function pn(t){return`Minified Redux error #${t}; visit https://redux.js.org/Errors?code=${t} for the full message or use the non-minified dev environment for full errors. `}var wR=typeof Symbol=="function"&&Symbol.observable||"@@observable",XE=wR,Nh=()=>Math.random().toString(36).substring(7).split("").join("."),TR={INIT:`@@redux/INIT${Nh()}`,REPLACE:`@@redux/REPLACE${Nh()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Nh()}`},ZE=TR;function SR(t){if(typeof t!="object"||t===null)return!1;let e=t;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e||Object.getPrototypeOf(t)===null}function Dh(t,e,n){if(typeof t!="function")throw new Error(pn(2));if(typeof e=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(pn(0));if(typeof e=="function"&&typeof n>"u"&&(n=e,e=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(pn(1));return n(Dh)(t,e)}let o=t,r=e,i=new Map,s=i,a=0,l=!1;function c(){s===i&&(s=new Map,i.forEach((_,b)=>{s.set(b,_)}))}function d(){if(l)throw new Error(pn(3));return r}function u(_){if(typeof _!="function")throw new Error(pn(4));if(l)throw new Error(pn(5));let b=!0;c();let y=a++;return s.set(y,_),function(){if(b){if(l)throw new Error(pn(6));b=!1,c(),s.delete(y),i=null}}}function p(_){if(!SR(_))throw new Error(pn(7));if(typeof _.type>"u")throw new Error(pn(8));if(typeof _.type!="string")throw new Error(pn(17));if(l)throw new Error(pn(9));try{l=!0,r=o(r,_)}finally{l=!1}return(i=s).forEach(y=>{y()}),_}function f(_){if(typeof _!="function")throw new Error(pn(10));o=_,p({type:ZE.REPLACE})}function h(){let _=u;return{subscribe(b){if(typeof b!="object"||b===null)throw new Error(pn(11));function y(){let v=b;v.next&&v.next(d())}return y(),{unsubscribe:_(y)}},[XE](){return this}}}return p({type:ZE.INIT}),{dispatch:p,subscribe:u,getState:d,replaceReducer:f,[XE]:h}}function QE(t,e){return function(...n){return e(t.apply(this,n))}}function Oh(t,e){if(typeof t=="function")return QE(t,e);if(typeof t!="object"||t===null)throw new Error(pn(16));let n={};for(let o in t){let r=t[o];typeof r=="function"&&(n[o]=QE(r,e))}return n}function Ih(...t){return t.length===0?e=>e:t.length===1?t[0]:t.reduce((e,n)=>(...o)=>e(n(...o)))}function e0(...t){return e=>(n,o)=>{let r=e(n,o),i=()=>{throw new Error(pn(15))},s={getState:r.getState,dispatch:(l,...c)=>i(l,...c)},a=t.map(l=>l(s));return i=Ih(...a)(r.dispatch),{...r,dispatch:i}}}pt();var NP=eh(r0(),1),LR=Uv.startsWith("19"),RR=Symbol.for(LR?"react.transitional.element":"react.element"),PR=Symbol.for("react.portal"),FR=Symbol.for("react.fragment"),BR=Symbol.for("react.strict_mode"),$R=Symbol.for("react.profiler"),zR=Symbol.for("react.consumer"),HR=Symbol.for("react.context"),u0=Symbol.for("react.forward_ref"),KR=Symbol.for("react.suspense"),UR=Symbol.for("react.suspense_list"),Rh=Symbol.for("react.memo"),jR=Symbol.for("react.lazy");var VR=u0,WR=Rh;function GR(t){if(typeof t=="object"&&t!==null){let{$$typeof:e}=t;switch(e){case RR:switch(t=t.type,t){case FR:case $R:case BR:case KR:case UR:return t;default:switch(t=t&&t.$$typeof,t){case HR:case u0:case jR:case Rh:return t;case zR:return t;default:return e}}case PR:return e}}}function YR(t){return GR(t)===Rh}function qR(t,e,n,o,{areStatesEqual:r,areOwnPropsEqual:i,areStatePropsEqual:s}){let a=!1,l,c,d,u,p;function f(y,x){return l=y,c=x,d=t(l,c),u=e(o,c),p=n(d,u,c),a=!0,p}function h(){return d=t(l,c),e.dependsOnOwnProps&&(u=e(o,c)),p=n(d,u,c),p}function m(){return t.dependsOnOwnProps&&(d=t(l,c)),e.dependsOnOwnProps&&(u=e(o,c)),p=n(d,u,c),p}function _(){let y=t(l,c),x=!s(y,d);return d=y,x&&(p=n(d,u,c)),p}function b(y,x){let v=!i(x,c),E=!r(y,l,x,c);return l=y,c=x,v&&E?h():v?m():E?_():p}return function(x,v){return a?b(x,v):f(x,v)}}function JR(t,{initMapStateToProps:e,initMapDispatchToProps:n,initMergeProps:o,...r}){let i=e(t,r),s=n(t,r),a=o(t,r);return qR(i,s,a,t,r)}function XR(t,e){let n={};for(let o in t){let r=t[o];typeof r=="function"&&(n[o]=(...i)=>e(r(...i)))}return n}function Ah(t){return function(n){let o=t(n);function r(){return o}return r.dependsOnOwnProps=!1,r}}function i0(t){return t.dependsOnOwnProps?!!t.dependsOnOwnProps:t.length!==1}function p0(t,e){return function(o,{displayName:r}){let i=function(a,l){return i.dependsOnOwnProps?i.mapToProps(a,l):i.mapToProps(a,void 0)};return i.dependsOnOwnProps=!0,i.mapToProps=function(a,l){i.mapToProps=t,i.dependsOnOwnProps=i0(t);let c=i(a,l);return typeof c=="function"&&(i.mapToProps=c,i.dependsOnOwnProps=i0(c),c=i(a,l)),c},i}}function Ph(t,e){return(n,o)=>{throw new Error(`Invalid value of type ${typeof t} for ${e} argument when connecting component ${o.wrappedComponentName}.`)}}function ZR(t){return t&&typeof t=="object"?Ah(e=>XR(t,e)):t?typeof t=="function"?p0(t,"mapDispatchToProps"):Ph(t,"mapDispatchToProps"):Ah(e=>({dispatch:e}))}function QR(t){return t?typeof t=="function"?p0(t,"mapStateToProps"):Ph(t,"mapStateToProps"):Ah(()=>({}))}function eP(t,e,n){return{...n,...t,...e}}function tP(t){return function(n,{displayName:o,areMergedPropsEqual:r}){let i=!1,s;return function(l,c,d){let u=t(l,c,d);return i?r(u,s)||(s=u):(i=!0,s=u),s}}}function nP(t){return t?typeof t=="function"?tP(t):Ph(t,"mergeProps"):()=>eP}function oP(t){t()}function rP(){let t=null,e=null;return{clear(){t=null,e=null},notify(){oP(()=>{let n=t;for(;n;)n.callback(),n=n.next})},get(){let n=[],o=t;for(;o;)n.push(o),o=o.next;return n},subscribe(n){let o=!0,r=e={callback:n,next:null,prev:e};return r.prev?r.prev.next=r:t=r,function(){!o||t===null||(o=!1,r.next?r.next.prev=r.prev:e=r.prev,r.prev?r.prev.next=r.next:t=r.next)}}}}var s0={notify(){},get:()=>[]};function f0(t,e){let n,o=s0,r=0,i=!1;function s(m){d();let _=o.subscribe(m),b=!1;return()=>{b||(b=!0,_(),u())}}function a(){o.notify()}function l(){h.onStateChange&&h.onStateChange()}function c(){return i}function d(){r++,n||(n=e?e.addNestedSub(l):t.subscribe(l),o=rP())}function u(){r--,n&&r===0&&(n(),n=void 0,o.clear(),o=s0)}function p(){i||(i=!0,d())}function f(){i&&(i=!1,u())}let h={addNestedSub:s,notifyNestedSubs:a,handleChangeWrapper:l,isSubscribed:c,trySubscribe:p,tryUnsubscribe:f,getListeners:()=>o};return h}var iP=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",sP=iP(),aP=()=>typeof navigator<"u"&&navigator.product==="ReactNative",lP=aP(),cP=()=>sP||lP?un:P,Kd=cP();function a0(t,e){return t===e?t!==0||e!==0||1/t===1/e:t!==t&&e!==e}function Mh(t,e){if(a0(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;let n=Object.keys(t),o=Object.keys(e);if(n.length!==o.length)return!1;for(let r=0;r<n.length;r++)if(!Object.prototype.hasOwnProperty.call(e,n[r])||!a0(t[n[r]],e[n[r]]))return!1;return!0}var dP={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},uP={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},pP={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},h0={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},fP={[VR]:pP,[WR]:h0};function l0(t){return YR(t)?h0:fP[t.$$typeof]||dP}var hP=Object.defineProperty,gP=Object.getOwnPropertyNames,c0=Object.getOwnPropertySymbols,mP=Object.getOwnPropertyDescriptor,_P=Object.getPrototypeOf,d0=Object.prototype;function Lh(t,e){if(typeof e!="string"){if(d0){let i=_P(e);i&&i!==d0&&Lh(t,i)}let n=gP(e);c0&&(n=n.concat(c0(e)));let o=l0(t),r=l0(e);for(let i=0;i<n.length;++i){let s=n[i];if(!uP[s]&&!(r&&r[s])&&!(o&&o[s])){let a=mP(e,s);try{hP(t,s,a)}catch{}}}}return t}var bP=Symbol.for("react-redux-context"),yP=typeof globalThis<"u"?globalThis:{};function xP(){if(!Ot)return{};let t=yP[bP]??=new Map,e=t.get(Ot);return e||(e=Ot(null),t.set(Ot,e)),e}var g0=xP(),vP=[null,null];function CP(t,e,n){Kd(()=>t(...e),n)}function EP(t,e,n,o,r,i){t.current=o,n.current=!1,r.current&&(r.current=null,i())}function wP(t,e,n,o,r,i,s,a,l,c,d){if(!t)return()=>{};let u=!1,p=null,f=()=>{if(u||!a.current)return;let m=e.getState(),_,b;try{_=o(m,r.current)}catch(y){b=y,p=y}b||(p=null),_===i.current?s.current||c():(i.current=_,l.current=_,s.current=!0,d())};return n.onStateChange=f,n.trySubscribe(),f(),()=>{if(u=!0,n.tryUnsubscribe(),n.onStateChange=null,p)throw p}}function TP(t,e){return t===e}function SP(t,e,n,{pure:o,areStatesEqual:r=TP,areOwnPropsEqual:i=Mh,areStatePropsEqual:s=Mh,areMergedPropsEqual:a=Mh,forwardRef:l=!1,context:c=g0}={}){let d=c,u=QR(t),p=ZR(e),f=nP(n),h=!!t;return _=>{let b=_.displayName||_.name||"Component",y=`Connect(${b})`,x={shouldHandleStateChanges:h,displayName:y,wrappedComponentName:b,WrappedComponent:_,initMapStateToProps:u,initMapDispatchToProps:p,initMergeProps:f,areStatesEqual:r,areStatePropsEqual:s,areOwnPropsEqual:i,areMergedPropsEqual:a};function v(k){let[T,w,S]=J(()=>{let{reactReduxForwardedRef:$t,...wn}=k;return[k.context,$t,wn]},[k]),N=J(()=>{let $t=d;return T?.Consumer,$t},[T,d]),D=It(N),O=!!k.store&&!!k.store.getState&&!!k.store.dispatch,M=!!D&&!!D.store,I=O?k.store:D.store,L=M?D.getServerState:I.getState,K=J(()=>JR(I.dispatch,x),[I]),[W,q]=J(()=>{if(!h)return vP;let $t=f0(I,O?void 0:D.subscription),wn=$t.notifyNestedSubs.bind($t);return[$t,wn]},[I,O,D]),B=J(()=>O?D:{...D,subscription:W},[O,D,W]),se=Y(void 0),me=Y(S),_t=Y(void 0),Zt=Y(!1),ut=Y(!1),bt=Y(void 0);Kd(()=>(ut.current=!0,()=>{ut.current=!1}),[]);let sn=J(()=>()=>_t.current&&S===me.current?_t.current:K(I.getState(),S),[I,S]),ye=J(()=>wn=>W?wP(h,I,W,K,me,se,Zt,ut,_t,q,wn):()=>{},[W]);CP(EP,[me,se,Zt,S,_t,q]);let Xe;try{Xe=zv(ye,sn,L?()=>K(L(),S):sn)}catch($t){throw bt.current&&($t.message+=`
|
|
19
|
-
The error may be correlated with this previous error:
|
|
20
|
-
${bt.current.stack}
|
|
21
|
-
|
|
22
|
-
`),$t}Kd(()=>{bt.current=void 0,_t.current=void 0,se.current=Xe});let st=J(()=>Bi(_,{...Xe,ref:w}),[w,_,Xe]);return J(()=>h?Bi(N.Provider,{value:B},st):st,[N,st,B])}let C=Hv(v);if(C.WrappedComponent=_,C.displayName=v.displayName=y,l){let T=$i(function(S,N){return Bi(C,{...S,reactReduxForwardedRef:N})});return T.displayName=y,T.WrappedComponent=_,Lh(T,_)}return Lh(C,_)}}var Fh=SP;function kP(t){let{children:e,context:n,serverState:o,store:r}=t,i=J(()=>{let l=f0(r);return{store:r,subscription:l,getServerState:o?()=>o:void 0}},[r,o]),s=J(()=>r.getState(),[r]);return Kd(()=>{let{subscription:l}=i;return l.onStateChange=l.notifyNestedSubs,l.trySubscribe(),s!==r.getState()&&l.notifyNestedSubs(),()=>{l.tryUnsubscribe(),l.onStateChange=void 0}},[i,s]),Bi((n||g0).Provider,{value:i},e)}var m0=kP;var DP=!0,Bh="Invariant failed";function _0(t,e){if(!t){if(DP)throw new Error(Bh);var n=typeof e=="function"?e():e,o=n?"".concat(Bh,": ").concat(n):Bh;throw new Error(o)}}var oo=function(e){var n=e.top,o=e.right,r=e.bottom,i=e.left,s=o-i,a=r-n,l={top:n,right:o,bottom:r,left:i,width:s,height:a,x:i,y:n,center:{x:(o+i)/2,y:(r+n)/2}};return l},Ud=function(e,n){return{top:e.top-n.top,left:e.left-n.left,bottom:e.bottom+n.bottom,right:e.right+n.right}},b0=function(e,n){return{top:e.top+n.top,left:e.left+n.left,bottom:e.bottom-n.bottom,right:e.right-n.right}},OP=function(e,n){return{top:e.top+n.y,left:e.left+n.x,bottom:e.bottom+n.y,right:e.right+n.x}},$h={top:0,right:0,bottom:0,left:0},jd=function(e){var n=e.borderBox,o=e.margin,r=o===void 0?$h:o,i=e.border,s=i===void 0?$h:i,a=e.padding,l=a===void 0?$h:a,c=oo(Ud(n,r)),d=oo(b0(n,s)),u=oo(b0(d,l));return{marginBox:c,borderBox:oo(n),paddingBox:d,contentBox:u,margin:r,border:s,padding:l}},no=function(e){var n=e.slice(0,-2),o=e.slice(-2);if(o!=="px")return 0;var r=Number(n);return isNaN(r)&&_0(!1),r},IP=function(){return{x:window.pageXOffset,y:window.pageYOffset}},Tl=function(e,n){var o=e.borderBox,r=e.border,i=e.margin,s=e.padding,a=OP(o,n);return jd({borderBox:a,border:r,margin:i,padding:s})},Sl=function(e,n){return n===void 0&&(n=IP()),Tl(e,n)},zh=function(e,n){var o={top:no(n.marginTop),right:no(n.marginRight),bottom:no(n.marginBottom),left:no(n.marginLeft)},r={top:no(n.paddingTop),right:no(n.paddingRight),bottom:no(n.paddingBottom),left:no(n.paddingLeft)},i={top:no(n.borderTopWidth),right:no(n.borderRightWidth),bottom:no(n.borderBottomWidth),left:no(n.borderLeftWidth)};return jd({borderBox:e,margin:o,padding:r,border:i})},Hh=function(e){var n=e.getBoundingClientRect(),o=window.getComputedStyle(e);return zh(n,o)};var MP=function(e){var n=[],o=null,r=function(){for(var s=arguments.length,a=new Array(s),l=0;l<s;l++)a[l]=arguments[l];n=a,!o&&(o=requestAnimationFrame(function(){o=null,e.apply(void 0,n)}))};return r.cancel=function(){o&&(cancelAnimationFrame(o),o=null)},r},Qs=MP;var AP=!0,LP=/[ \t]{2,}/g,RP=/^[ \t]*/gm,y0=t=>t.replace(LP," ").replace(RP,"").trim(),PP=t=>y0(`
|
|
23
|
-
%c@hello-pangea/dnd
|
|
24
|
-
|
|
25
|
-
%c${y0(t)}
|
|
26
|
-
|
|
27
|
-
%c\u{1F477}\u200D This is a development only message. It will be removed in production builds.
|
|
28
|
-
`),FP=t=>[PP(t),"color: #00C584; font-size: 1.2em; font-weight: bold;","line-height: 1.5","color: #723874;"],BP="__@hello-pangea/dnd-disable-dev-warnings";function G0(t,e){AP||typeof window<"u"&&window[BP]||console[t](...FP(e))}var K9=G0.bind(null,"warn"),$P=G0.bind(null,"error");function Xr(){}function zP(t,e){return{...t,...e}}function ro(t,e,n){let o=e.map(r=>{let i=zP(n,r.options);return t.addEventListener(r.eventName,r.fn,i),function(){t.removeEventListener(r.eventName,r.fn,i)}});return function(){o.forEach(i=>{i()})}}var HP=!0,x0="Invariant failed",Wi=class extends Error{};Wi.prototype.toString=function(){return this.message};function j(t,e){throw HP?new Wi(x0):new Wi(`${x0}: ${e||""}`)}var Zh=class extends et.Component{constructor(...e){super(...e),this.callbacks=null,this.unbind=Xr,this.onWindowError=n=>{let o=this.getCallbacks();o.isDragging()&&o.tryAbort(),n.error instanceof Wi&&n.preventDefault()},this.getCallbacks=()=>{if(!this.callbacks)throw new Error("Unable to find AppCallbacks in <ErrorBoundary/>");return this.callbacks},this.setCallbacks=n=>{this.callbacks=n}}componentDidMount(){this.unbind=ro(window,[{eventName:"error",fn:this.onWindowError}])}componentDidCatch(e){if(e instanceof Wi){this.setState({});return}throw e}componentWillUnmount(){this.unbind()}render(){return this.props.children(this.setCallbacks)}},KP=`
|
|
29
|
-
Press space bar to start a drag.
|
|
30
|
-
When dragging you can use the arrow keys to move the item around and escape to cancel.
|
|
31
|
-
Some screen readers may require you to be in focus mode or to use your pass through key
|
|
32
|
-
`,qd=t=>t+1,UP=t=>`
|
|
33
|
-
You have lifted an item in position ${qd(t.source.index)}
|
|
34
|
-
`,Y0=(t,e)=>{let n=t.droppableId===e.droppableId,o=qd(t.index),r=qd(e.index);return n?`
|
|
35
|
-
You have moved the item from position ${o}
|
|
36
|
-
to position ${r}
|
|
37
|
-
`:`
|
|
38
|
-
You have moved the item from position ${o}
|
|
39
|
-
in list ${t.droppableId}
|
|
40
|
-
to list ${e.droppableId}
|
|
41
|
-
in position ${r}
|
|
42
|
-
`},q0=(t,e,n)=>e.droppableId===n.droppableId?`
|
|
43
|
-
The item ${t}
|
|
44
|
-
has been combined with ${n.draggableId}`:`
|
|
45
|
-
The item ${t}
|
|
46
|
-
in list ${e.droppableId}
|
|
47
|
-
has been combined with ${n.draggableId}
|
|
48
|
-
in list ${n.droppableId}
|
|
49
|
-
`,jP=t=>{let e=t.destination;if(e)return Y0(t.source,e);let n=t.combine;return n?q0(t.draggableId,t.source,n):"You are over an area that cannot be dropped on"},v0=t=>`
|
|
50
|
-
The item has returned to its starting position
|
|
51
|
-
of ${qd(t.index)}
|
|
52
|
-
`,VP=t=>{if(t.reason==="CANCEL")return`
|
|
53
|
-
Movement cancelled.
|
|
54
|
-
${v0(t.source)}
|
|
55
|
-
`;let e=t.destination,n=t.combine;return e?`
|
|
56
|
-
You have dropped the item.
|
|
57
|
-
${Y0(t.source,e)}
|
|
58
|
-
`:n?`
|
|
59
|
-
You have dropped the item.
|
|
60
|
-
${q0(t.draggableId,t.source,n)}
|
|
61
|
-
`:`
|
|
62
|
-
The item has been dropped while not over a drop area.
|
|
63
|
-
${v0(t.source)}
|
|
64
|
-
`},Yd={dragHandleUsageInstructions:KP,onDragStart:UP,onDragUpdate:jP,onDragEnd:VP};function WP(t,e){return!!(t===e||Number.isNaN(t)&&Number.isNaN(e))}function J0(t,e){if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(!WP(t[n],e[n]))return!1;return!0}function Le(t,e){let n=R(()=>({inputs:e,result:t()}))[0],o=Y(!0),r=Y(n),s=o.current||!!(e&&r.current.inputs&&J0(e,r.current.inputs))?r.current:{inputs:e,result:t()};return P(()=>{o.current=!1,r.current=s},[s]),s.result}function ae(t,e){return Le(()=>t,e)}var Kt={x:0,y:0},tn=(t,e)=>({x:t.x+e.x,y:t.y+e.y}),Kn=(t,e)=>({x:t.x-e.x,y:t.y-e.y}),Zr=(t,e)=>t.x===e.x&&t.y===e.y,oa=t=>({x:t.x!==0?-t.x:0,y:t.y!==0?-t.y:0}),Gi=(t,e,n=0)=>t==="x"?{x:e,y:n}:{x:n,y:e},Ml=(t,e)=>Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2),C0=(t,e)=>Math.min(...e.map(n=>Ml(t,n))),X0=t=>e=>({x:t(e.x),y:t(e.y)}),GP=(t,e)=>{let n=oo({top:Math.max(e.top,t.top),right:Math.min(e.right,t.right),bottom:Math.min(e.bottom,t.bottom),left:Math.max(e.left,t.left)});return n.width<=0||n.height<=0?null:n},$l=(t,e)=>({top:t.top+e.y,left:t.left+e.x,bottom:t.bottom+e.y,right:t.right+e.x}),E0=t=>[{x:t.left,y:t.top},{x:t.right,y:t.top},{x:t.left,y:t.bottom},{x:t.right,y:t.bottom}],YP={top:0,right:0,bottom:0,left:0},qP=(t,e)=>e?$l(t,e.scroll.diff.displacement):t,JP=(t,e,n)=>n&&n.increasedBy?{...t,[e.end]:t[e.end]+n.increasedBy[e.line]}:t,XP=(t,e)=>e&&e.shouldClipSubject?GP(e.pageMarginBox,t):oo(t),ea=({page:t,withPlaceholder:e,axis:n,frame:o})=>{let r=qP(t.marginBox,o),i=JP(r,n,e),s=XP(i,o);return{page:t,withPlaceholder:e,active:s}},sg=(t,e)=>{t.frame||j();let n=t.frame,o=Kn(e,n.scroll.initial),r=oa(o),i={...n,scroll:{initial:n.scroll.initial,current:e,diff:{value:o,displacement:r},max:n.scroll.max}},s=ea({page:t.subject.page,withPlaceholder:t.subject.withPlaceholder,axis:t.axis,frame:i});return{...t,frame:i,subject:s}};function Ht(t,e=J0){let n=null;function o(...r){if(n&&n.lastThis===this&&e(r,n.lastArgs))return n.lastResult;let i=t.apply(this,r);return n={lastResult:i,lastArgs:r,lastThis:this},i}return o.clear=function(){n=null},o}var Z0=Ht(t=>t.reduce((e,n)=>(e[n.descriptor.id]=n,e),{})),Q0=Ht(t=>t.reduce((e,n)=>(e[n.descriptor.id]=n,e),{})),Zd=Ht(t=>Object.values(t)),ZP=Ht(t=>Object.values(t)),ra=Ht((t,e)=>ZP(e).filter(o=>t===o.descriptor.droppableId).sort((o,r)=>o.descriptor.index-r.descriptor.index));function ag(t){return t.at&&t.at.type==="REORDER"?t.at.destination:null}function Qd(t){return t.at&&t.at.type==="COMBINE"?t.at.combine:null}var eu=Ht((t,e)=>e.filter(n=>n.descriptor.id!==t.descriptor.id)),QP=({isMovingForward:t,draggable:e,destination:n,insideDestination:o,previousImpact:r})=>{if(!n.isCombineEnabled||!ag(r))return null;function s(f){let h={type:"COMBINE",combine:{draggableId:f,droppableId:n.descriptor.id}};return{...r,at:h}}let a=r.displaced.all,l=a.length?a[0]:null;if(t)return l?s(l):null;let c=eu(e,o);if(!l){if(!c.length)return null;let f=c[c.length-1];return s(f.descriptor.id)}let d=c.findIndex(f=>f.descriptor.id===l);d===-1&&j();let u=d-1;if(u<0)return null;let p=c[u];return s(p.descriptor.id)},ia=(t,e)=>t.descriptor.droppableId===e.descriptor.id,ew={point:Kt,value:0},Al={invisible:{},visible:{},all:[]},eF={displaced:Al,displacedBy:ew,at:null},io=(t,e)=>n=>t<=n&&n<=e,tw=t=>{let e=io(t.top,t.bottom),n=io(t.left,t.right);return o=>{if(e(o.top)&&e(o.bottom)&&n(o.left)&&n(o.right))return!0;let i=e(o.top)||e(o.bottom),s=n(o.left)||n(o.right);if(i&&s)return!0;let l=o.top<t.top&&o.bottom>t.bottom,c=o.left<t.left&&o.right>t.right;return l&&c?!0:l&&s||c&&i}},tF=t=>{let e=io(t.top,t.bottom),n=io(t.left,t.right);return o=>e(o.top)&&e(o.bottom)&&n(o.left)&&n(o.right)},lg={direction:"vertical",line:"y",crossAxisLine:"x",start:"top",end:"bottom",size:"height",crossAxisStart:"left",crossAxisEnd:"right",crossAxisSize:"width"},nw={direction:"horizontal",line:"x",crossAxisLine:"y",start:"left",end:"right",size:"width",crossAxisStart:"top",crossAxisEnd:"bottom",crossAxisSize:"height"},nF=t=>e=>{let n=io(e.top,e.bottom),o=io(e.left,e.right);return r=>t===lg?n(r.top)&&n(r.bottom):o(r.left)&&o(r.right)},oF=(t,e)=>{let n=e.frame?e.frame.scroll.diff.displacement:Kt;return $l(t,n)},rF=(t,e,n)=>e.subject.active?n(e.subject.active)(t):!1,iF=(t,e,n)=>n(e)(t),cg=({target:t,destination:e,viewport:n,withDroppableDisplacement:o,isVisibleThroughFrameFn:r})=>{let i=o?oF(t,e):t;return rF(i,e,r)&&iF(i,n,r)},sF=t=>cg({...t,isVisibleThroughFrameFn:tw}),ow=t=>cg({...t,isVisibleThroughFrameFn:tF}),aF=t=>cg({...t,isVisibleThroughFrameFn:nF(t.destination.axis)}),lF=(t,e,n)=>{if(typeof n=="boolean")return n;if(!e)return!0;let{invisible:o,visible:r}=e;if(o[t])return!1;let i=r[t];return i?i.shouldAnimate:!0};function cF(t,e){let n=t.page.marginBox,o={top:e.point.y,right:0,bottom:0,left:e.point.x};return oo(Ud(n,o))}function Ll({afterDragging:t,destination:e,displacedBy:n,viewport:o,forceShouldAnimate:r,last:i}){return t.reduce(function(a,l){let c=cF(l,n),d=l.descriptor.id;if(a.all.push(d),!sF({target:c,destination:e,viewport:o,withDroppableDisplacement:!0}))return a.invisible[l.descriptor.id]=!0,a;let p=lF(d,i,r),f={draggableId:d,shouldAnimate:p};return a.visible[d]=f,a},{all:[],visible:{},invisible:{}})}function dF(t,e){if(!t.length)return 0;let n=t[t.length-1].descriptor.index;return e.inHomeList?n:n+1}function w0({insideDestination:t,inHomeList:e,displacedBy:n,destination:o}){let r=dF(t,{inHomeList:e});return{displaced:Al,displacedBy:n,at:{type:"REORDER",destination:{droppableId:o.descriptor.id,index:r}}}}function Jd({draggable:t,insideDestination:e,destination:n,viewport:o,displacedBy:r,last:i,index:s,forceShouldAnimate:a}){let l=ia(t,n);if(s==null)return w0({insideDestination:e,inHomeList:l,displacedBy:r,destination:n});let c=e.find(h=>h.descriptor.index===s);if(!c)return w0({insideDestination:e,inHomeList:l,displacedBy:r,destination:n});let d=eu(t,e),u=e.indexOf(c),p=d.slice(u);return{displaced:Ll({afterDragging:p,destination:n,displacedBy:r,last:i,viewport:o.frame,forceShouldAnimate:a}),displacedBy:r,at:{type:"REORDER",destination:{droppableId:n.descriptor.id,index:s}}}}function Qr(t,e){return!!e.effected[t]}var uF=({isMovingForward:t,destination:e,draggables:n,combine:o,afterCritical:r})=>{if(!e.isCombineEnabled)return null;let i=o.draggableId,a=n[i].descriptor.index;return Qr(i,r)?t?a:a-1:t?a+1:a},pF=({isMovingForward:t,isInHomeList:e,insideDestination:n,location:o})=>{if(!n.length)return null;let r=o.index,i=t?r+1:r-1,s=n[0].descriptor.index,a=n[n.length-1].descriptor.index,l=e?a:a+1;return i<s||i>l?null:i},fF=({isMovingForward:t,isInHomeList:e,draggable:n,draggables:o,destination:r,insideDestination:i,previousImpact:s,viewport:a,afterCritical:l})=>{let c=s.at;if(c||j(),c.type==="REORDER"){let u=pF({isMovingForward:t,isInHomeList:e,location:c.destination,insideDestination:i});return u==null?null:Jd({draggable:n,insideDestination:i,destination:r,viewport:a,last:s.displaced,displacedBy:s.displacedBy,index:u})}let d=uF({isMovingForward:t,destination:r,displaced:s.displaced,draggables:o,combine:c.combine,afterCritical:l});return d==null?null:Jd({draggable:n,insideDestination:i,destination:r,viewport:a,last:s.displaced,displacedBy:s.displacedBy,index:d})},hF=({displaced:t,afterCritical:e,combineWith:n,displacedBy:o})=>{let r=!!(t.visible[n]||t.invisible[n]);return Qr(n,e)?r?Kt:oa(o.point):r?o.point:Kt},gF=({afterCritical:t,impact:e,draggables:n})=>{let o=Qd(e);o||j();let r=o.draggableId,i=n[r].page.borderBox.center,s=hF({displaced:e.displaced,afterCritical:t,combineWith:r,displacedBy:e.displacedBy});return tn(i,s)},rw=(t,e)=>e.margin[t.start]+e.borderBox[t.size]/2,mF=(t,e)=>e.margin[t.end]+e.borderBox[t.size]/2,dg=(t,e,n)=>e[t.crossAxisStart]+n.margin[t.crossAxisStart]+n.borderBox[t.crossAxisSize]/2,T0=({axis:t,moveRelativeTo:e,isMoving:n})=>Gi(t.line,e.marginBox[t.end]+rw(t,n),dg(t,e.marginBox,n)),S0=({axis:t,moveRelativeTo:e,isMoving:n})=>Gi(t.line,e.marginBox[t.start]-mF(t,n),dg(t,e.marginBox,n)),_F=({axis:t,moveInto:e,isMoving:n})=>Gi(t.line,e.contentBox[t.start]+rw(t,n),dg(t,e.contentBox,n)),bF=({impact:t,draggable:e,draggables:n,droppable:o,afterCritical:r})=>{let i=ra(o.descriptor.id,n),s=e.page,a=o.axis;if(!i.length)return _F({axis:a,moveInto:o.page,isMoving:s});let{displaced:l,displacedBy:c}=t,d=l.all[0];if(d){let p=n[d];if(Qr(d,r))return S0({axis:a,moveRelativeTo:p.page,isMoving:s});let f=Tl(p.page,c.point);return S0({axis:a,moveRelativeTo:f,isMoving:s})}let u=i[i.length-1];if(u.descriptor.id===e.descriptor.id)return s.borderBox.center;if(Qr(u.descriptor.id,r)){let p=Tl(u.page,oa(r.displacedBy.point));return T0({axis:a,moveRelativeTo:p,isMoving:s})}return T0({axis:a,moveRelativeTo:u.page,isMoving:s})},Qh=(t,e)=>{let n=t.frame;return n?tn(e,n.scroll.diff.displacement):e},yF=({impact:t,draggable:e,droppable:n,draggables:o,afterCritical:r})=>{let i=e.page.borderBox.center,s=t.at;return!n||!s?i:s.type==="REORDER"?bF({impact:t,draggable:e,draggables:o,droppable:n,afterCritical:r}):gF({impact:t,draggables:o,afterCritical:r})},tu=t=>{let e=yF(t),n=t.droppable;return n?Qh(n,e):e},iw=(t,e)=>{let n=Kn(e,t.scroll.initial),o=oa(n);return{frame:oo({top:e.y,bottom:e.y+t.frame.height,left:e.x,right:e.x+t.frame.width}),scroll:{initial:t.scroll.initial,max:t.scroll.max,current:e,diff:{value:n,displacement:o}}}};function k0(t,e){return t.map(n=>e[n])}function xF(t,e){for(let n=0;n<e.length;n++){let o=e[n].visible[t];if(o)return o}return null}var vF=({impact:t,viewport:e,destination:n,draggables:o,maxScrollChange:r})=>{let i=iw(e,tn(e.scroll.current,r)),s=n.frame?sg(n,tn(n.frame.scroll.current,r)):n,a=t.displaced,l=Ll({afterDragging:k0(a.all,o),destination:n,displacedBy:t.displacedBy,viewport:i.frame,last:a,forceShouldAnimate:!1}),c=Ll({afterDragging:k0(a.all,o),destination:s,displacedBy:t.displacedBy,viewport:e.frame,last:a,forceShouldAnimate:!1}),d={},u={},p=[a,l,c];return a.all.forEach(h=>{let m=xF(h,p);if(m){u[h]=m;return}d[h]=!0}),{...t,displaced:{all:a.all,invisible:d,visible:u}}},CF=(t,e)=>tn(t.scroll.diff.displacement,e),ug=({pageBorderBoxCenter:t,draggable:e,viewport:n})=>{let o=CF(n,t),r=Kn(o,e.page.borderBox.center);return tn(e.client.borderBox.center,r)},sw=({draggable:t,destination:e,newPageBorderBoxCenter:n,viewport:o,withDroppableDisplacement:r,onlyOnMainAxis:i=!1})=>{let s=Kn(n,t.page.borderBox.center),l={target:$l(t.page.borderBox,s),destination:e,withDroppableDisplacement:r,viewport:o};return i?aF(l):ow(l)},EF=({isMovingForward:t,draggable:e,destination:n,draggables:o,previousImpact:r,viewport:i,previousPageBorderBoxCenter:s,previousClientSelection:a,afterCritical:l})=>{if(!n.isEnabled)return null;let c=ra(n.descriptor.id,o),d=ia(e,n),u=QP({isMovingForward:t,draggable:e,destination:n,insideDestination:c,previousImpact:r})||fF({isMovingForward:t,isInHomeList:d,draggable:e,draggables:o,destination:n,insideDestination:c,previousImpact:r,viewport:i,afterCritical:l});if(!u)return null;let p=tu({impact:u,draggable:e,droppable:n,draggables:o,afterCritical:l});if(sw({draggable:e,destination:n,newPageBorderBoxCenter:p,viewport:i.frame,withDroppableDisplacement:!1,onlyOnMainAxis:!0}))return{clientSelection:ug({pageBorderBoxCenter:p,draggable:e,viewport:i}),impact:u,scrollJumpRequest:null};let h=Kn(p,s),m=vF({impact:u,viewport:i,destination:n,draggables:o,maxScrollChange:h});return{clientSelection:a,impact:m,scrollJumpRequest:h}},fn=t=>{let e=t.subject.active;return e||j(),e},wF=({isMovingForward:t,pageBorderBoxCenter:e,source:n,droppables:o,viewport:r})=>{let i=n.subject.active;if(!i)return null;let s=n.axis,a=io(i[s.start],i[s.end]),l=Zd(o).filter(d=>d!==n).filter(d=>d.isEnabled).filter(d=>!!d.subject.active).filter(d=>tw(r.frame)(fn(d))).filter(d=>{let u=fn(d);return t?i[s.crossAxisEnd]<u[s.crossAxisEnd]:u[s.crossAxisStart]<i[s.crossAxisStart]}).filter(d=>{let u=fn(d),p=io(u[s.start],u[s.end]);return a(u[s.start])||a(u[s.end])||p(i[s.start])||p(i[s.end])}).sort((d,u)=>{let p=fn(d)[s.crossAxisStart],f=fn(u)[s.crossAxisStart];return t?p-f:f-p}).filter((d,u,p)=>fn(d)[s.crossAxisStart]===fn(p[0])[s.crossAxisStart]);if(!l.length)return null;if(l.length===1)return l[0];let c=l.filter(d=>io(fn(d)[s.start],fn(d)[s.end])(e[s.line]));return c.length===1?c[0]:c.length>1?c.sort((d,u)=>fn(d)[s.start]-fn(u)[s.start])[0]:l.sort((d,u)=>{let p=C0(e,E0(fn(d))),f=C0(e,E0(fn(u)));return p!==f?p-f:fn(d)[s.start]-fn(u)[s.start]})[0]},N0=(t,e)=>{let n=t.page.borderBox.center;return Qr(t.descriptor.id,e)?Kn(n,e.displacedBy.point):n},TF=(t,e)=>{let n=t.page.borderBox;return Qr(t.descriptor.id,e)?$l(n,oa(e.displacedBy.point)):n},SF=({pageBorderBoxCenter:t,viewport:e,destination:n,insideDestination:o,afterCritical:r})=>o.filter(s=>ow({target:TF(s,r),destination:n,viewport:e.frame,withDroppableDisplacement:!0})).sort((s,a)=>{let l=Ml(t,Qh(n,N0(s,r))),c=Ml(t,Qh(n,N0(a,r)));return l<c?-1:c<l?1:s.descriptor.index-a.descriptor.index})[0]||null,zl=Ht(function(e,n){let o=n[e.line];return{value:o,point:Gi(e.line,o)}}),kF=(t,e,n)=>{let o=t.axis;if(t.descriptor.mode==="virtual")return Gi(o.line,e[o.line]);let r=t.subject.page.contentBox[o.size],l=ra(t.descriptor.id,n).reduce((c,d)=>c+d.client.marginBox[o.size],0)+e[o.line]-r;return l<=0?null:Gi(o.line,l)},aw=(t,e)=>({...t,scroll:{...t.scroll,max:e}}),lw=(t,e,n)=>{let o=t.frame;ia(e,t)&&j(),t.subject.withPlaceholder&&j();let r=zl(t.axis,e.displaceBy).point,i=kF(t,r,n),s={placeholderSize:r,increasedBy:i,oldFrameMaxScroll:t.frame?t.frame.scroll.max:null};if(!o){let d=ea({page:t.subject.page,withPlaceholder:s,axis:t.axis,frame:t.frame});return{...t,subject:d}}let a=i?tn(o.scroll.max,i):o.scroll.max,l=aw(o,a),c=ea({page:t.subject.page,withPlaceholder:s,axis:t.axis,frame:l});return{...t,subject:c,frame:l}},NF=t=>{let e=t.subject.withPlaceholder;e||j();let n=t.frame;if(!n){let s=ea({page:t.subject.page,axis:t.axis,frame:null,withPlaceholder:null});return{...t,subject:s}}let o=e.oldFrameMaxScroll;o||j();let r=aw(n,o),i=ea({page:t.subject.page,axis:t.axis,frame:r,withPlaceholder:null});return{...t,subject:i,frame:r}},DF=({previousPageBorderBoxCenter:t,moveRelativeTo:e,insideDestination:n,draggable:o,draggables:r,destination:i,viewport:s,afterCritical:a})=>{if(!e){if(n.length)return null;let u={displaced:Al,displacedBy:ew,at:{type:"REORDER",destination:{droppableId:i.descriptor.id,index:0}}},p=tu({impact:u,draggable:o,droppable:i,draggables:r,afterCritical:a}),f=ia(o,i)?i:lw(i,o,r);return sw({draggable:o,destination:f,newPageBorderBoxCenter:p,viewport:s.frame,withDroppableDisplacement:!1,onlyOnMainAxis:!0})?u:null}let l=t[i.axis.line]<=e.page.borderBox.center[i.axis.line],c=(()=>{let u=e.descriptor.index;return e.descriptor.id===o.descriptor.id||l?u:u+1})(),d=zl(i.axis,o.displaceBy);return Jd({draggable:o,insideDestination:n,destination:i,viewport:s,displacedBy:d,last:Al,index:c})},OF=({isMovingForward:t,previousPageBorderBoxCenter:e,draggable:n,isOver:o,draggables:r,droppables:i,viewport:s,afterCritical:a})=>{let l=wF({isMovingForward:t,pageBorderBoxCenter:e,source:o,droppables:i,viewport:s});if(!l)return null;let c=ra(l.descriptor.id,r),d=SF({pageBorderBoxCenter:e,viewport:s,destination:l,insideDestination:c,afterCritical:a}),u=DF({previousPageBorderBoxCenter:e,destination:l,draggable:n,draggables:r,moveRelativeTo:d,insideDestination:c,viewport:s,afterCritical:a});if(!u)return null;let p=tu({impact:u,draggable:n,droppable:l,draggables:r,afterCritical:a});return{clientSelection:ug({pageBorderBoxCenter:p,draggable:n,viewport:s}),impact:u,scrollJumpRequest:null}},Un=t=>{let e=t.at;return e?e.type==="REORDER"?e.destination.droppableId:e.combine.droppableId:null},IF=(t,e)=>{let n=Un(t);return n?e[n]:null},MF=({state:t,type:e})=>{let n=IF(t.impact,t.dimensions.droppables),o=!!n,r=t.dimensions.droppables[t.critical.droppable.id],i=n||r,s=i.axis.direction,a=s==="vertical"&&(e==="MOVE_UP"||e==="MOVE_DOWN")||s==="horizontal"&&(e==="MOVE_LEFT"||e==="MOVE_RIGHT");if(a&&!o)return null;let l=e==="MOVE_DOWN"||e==="MOVE_RIGHT",c=t.dimensions.draggables[t.critical.draggable.id],d=t.current.page.borderBoxCenter,{draggables:u,droppables:p}=t.dimensions;return a?EF({isMovingForward:l,previousPageBorderBoxCenter:d,draggable:c,destination:i,draggables:u,viewport:t.viewport,previousClientSelection:t.current.client.selection,previousImpact:t.impact,afterCritical:t.afterCritical}):OF({isMovingForward:l,previousPageBorderBoxCenter:d,draggable:c,isOver:i,draggables:u,droppables:p,viewport:t.viewport,afterCritical:t.afterCritical})};function Vi(t){return t.phase==="DRAGGING"||t.phase==="COLLECTING"}function cw(t){let e=io(t.top,t.bottom),n=io(t.left,t.right);return function(r){return e(r.y)&&n(r.x)}}function AF(t,e){return t.left<e.right&&t.right>e.left&&t.top<e.bottom&&t.bottom>e.top}function LF({pageBorderBox:t,draggable:e,candidates:n}){let o=e.page.borderBox.center,r=n.map(i=>{let s=i.axis,a=Gi(i.axis.line,t.center[s.line],i.page.borderBox.center[s.crossAxisLine]);return{id:i.descriptor.id,distance:Ml(o,a)}}).sort((i,s)=>s.distance-i.distance);return r[0]?r[0].id:null}function RF({pageBorderBox:t,draggable:e,droppables:n}){let o=Zd(n).filter(r=>{if(!r.isEnabled)return!1;let i=r.subject.active;if(!i||!AF(t,i))return!1;if(cw(i)(t.center))return!0;let s=r.axis,a=i.center[s.crossAxisLine],l=t[s.crossAxisStart],c=t[s.crossAxisEnd],d=io(i[s.crossAxisStart],i[s.crossAxisEnd]),u=d(l),p=d(c);return!u&&!p?!0:u?l<a:c>a});return o.length?o.length===1?o[0].descriptor.id:LF({pageBorderBox:t,draggable:e,candidates:o}):null}var dw=(t,e)=>oo($l(t,e)),PF=(t,e)=>{let n=t.frame;return n?dw(e,n.scroll.diff.value):e};function uw({displaced:t,id:e}){return!!(t.visible[e]||t.invisible[e])}function FF({draggable:t,closest:e,inHomeList:n}){return e?n&&e.descriptor.index>t.descriptor.index?e.descriptor.index-1:e.descriptor.index:null}var BF=({pageBorderBoxWithDroppableScroll:t,draggable:e,destination:n,insideDestination:o,last:r,viewport:i,afterCritical:s})=>{let a=n.axis,l=zl(n.axis,e.displaceBy),c=l.value,d=t[a.start],u=t[a.end],f=eu(e,o).find(m=>{let _=m.descriptor.id,b=m.page.borderBox.center[a.line],y=Qr(_,s),x=uw({displaced:r,id:_});return y?x?u<=b:d<b-c:x?u<=b+c:d<b})||null,h=FF({draggable:e,closest:f,inHomeList:ia(e,n)});return Jd({draggable:e,insideDestination:o,destination:n,viewport:i,last:r,displacedBy:l,index:h})},$F=4,zF=({draggable:t,pageBorderBoxWithDroppableScroll:e,previousImpact:n,destination:o,insideDestination:r,afterCritical:i})=>{if(!o.isCombineEnabled)return null;let s=o.axis,a=zl(o.axis,t.displaceBy),l=a.value,c=e[s.start],d=e[s.end],p=eu(t,r).find(h=>{let m=h.descriptor.id,_=h.page.borderBox,y=_[s.size]/$F,x=Qr(m,i),v=uw({displaced:n.displaced,id:m});return x?v?d>_[s.start]+y&&d<_[s.end]-y:c>_[s.start]-l+y&&c<_[s.end]-l-y:v?d>_[s.start]+l+y&&d<_[s.end]+l-y:c>_[s.start]+y&&c<_[s.end]-y});return p?{displacedBy:a,displaced:n.displaced,at:{type:"COMBINE",combine:{draggableId:p.descriptor.id,droppableId:o.descriptor.id}}}:null},pw=({pageOffset:t,draggable:e,draggables:n,droppables:o,previousImpact:r,viewport:i,afterCritical:s})=>{let a=dw(e.page.borderBox,t),l=RF({pageBorderBox:a,draggable:e,droppables:o});if(!l)return eF;let c=o[l],d=ra(c.descriptor.id,n),u=PF(c,a);return zF({pageBorderBoxWithDroppableScroll:u,draggable:e,previousImpact:r,destination:c,insideDestination:d,afterCritical:s})||BF({pageBorderBoxWithDroppableScroll:u,draggable:e,destination:c,insideDestination:d,last:r.displaced,viewport:i,afterCritical:s})},pg=(t,e)=>({...t,[e.descriptor.id]:e}),HF=({previousImpact:t,impact:e,droppables:n})=>{let o=Un(t),r=Un(e);if(!o||o===r)return n;let i=n[o];if(!i.subject.withPlaceholder)return n;let s=NF(i);return pg(n,s)},KF=({draggable:t,draggables:e,droppables:n,previousImpact:o,impact:r})=>{let i=HF({previousImpact:o,impact:r,droppables:n}),s=Un(r);if(!s)return i;let a=n[s];if(ia(t,a)||a.subject.withPlaceholder)return i;let l=lw(a,t,e);return pg(i,l)},Ol=({state:t,clientSelection:e,dimensions:n,viewport:o,impact:r,scrollJumpRequest:i})=>{let s=o||t.viewport,a=n||t.dimensions,l=e||t.current.client.selection,c=Kn(l,t.initial.client.selection),d={offset:c,selection:l,borderBoxCenter:tn(t.initial.client.borderBoxCenter,c)},u={selection:tn(d.selection,s.scroll.current),borderBoxCenter:tn(d.borderBoxCenter,s.scroll.current),offset:tn(d.offset,s.scroll.diff.value)},p={client:d,page:u};if(t.phase==="COLLECTING")return{...t,dimensions:a,viewport:s,current:p};let f=a.draggables[t.critical.draggable.id],h=r||pw({pageOffset:u.offset,draggable:f,draggables:a.draggables,droppables:a.droppables,previousImpact:t.impact,viewport:s,afterCritical:t.afterCritical}),m=KF({draggable:f,impact:h,previousImpact:t.impact,draggables:a.draggables,droppables:a.droppables});return{...t,current:p,dimensions:{draggables:a.draggables,droppables:m},impact:h,viewport:s,scrollJumpRequest:i||null,forceShouldAnimate:i?!1:null}};function UF(t,e){return t.map(n=>e[n])}var fw=({impact:t,viewport:e,draggables:n,destination:o,forceShouldAnimate:r})=>{let i=t.displaced,s=UF(i.all,n),a=Ll({afterDragging:s,destination:o,displacedBy:t.displacedBy,viewport:e.frame,forceShouldAnimate:r,last:i});return{...t,displaced:a}},hw=({impact:t,draggable:e,droppable:n,draggables:o,viewport:r,afterCritical:i})=>{let s=tu({impact:t,draggable:e,draggables:o,droppable:n,afterCritical:i});return ug({pageBorderBoxCenter:s,draggable:e,viewport:r})},gw=({state:t,dimensions:e,viewport:n})=>{t.movementMode!=="SNAP"&&j();let o=t.impact,r=n||t.viewport,i=e||t.dimensions,{draggables:s,droppables:a}=i,l=s[t.critical.draggable.id],c=Un(o);c||j();let d=a[c],u=fw({impact:o,viewport:r,destination:d,draggables:s}),p=hw({impact:u,draggable:l,droppable:d,draggables:s,viewport:r,afterCritical:t.afterCritical});return Ol({impact:u,clientSelection:p,state:t,dimensions:i,viewport:r})},jF=t=>({index:t.index,droppableId:t.droppableId}),mw=({draggable:t,home:e,draggables:n,viewport:o})=>{let r=zl(e.axis,t.displaceBy),i=ra(e.descriptor.id,n),s=i.indexOf(t);s===-1&&j();let a=i.slice(s+1),l=a.reduce((p,f)=>(p[f.descriptor.id]=!0,p),{}),c={inVirtualList:e.descriptor.mode==="virtual",displacedBy:r,effected:l};return{impact:{displaced:Ll({afterDragging:a,destination:e,displacedBy:r,last:null,viewport:o.frame,forceShouldAnimate:!1}),displacedBy:r,at:{type:"REORDER",destination:jF(t.descriptor)}},afterCritical:c}},VF=(t,e)=>({draggables:t.draggables,droppables:pg(t.droppables,e)}),Hl=t=>{},Kl=t=>{},WF=({draggable:t,offset:e,initialWindowScroll:n})=>{let o=Tl(t.client,e),r=Sl(o,n);return{...t,placeholder:{...t.placeholder,client:o},client:o,page:r}},GF=t=>{let e=t.frame;return e||j(),e},YF=({additions:t,updatedDroppables:e,viewport:n})=>{let o=n.scroll.diff.value;return t.map(r=>{let i=r.descriptor.droppableId,s=e[i],l=GF(s).scroll.diff.value,c=tn(o,l);return WF({draggable:r,offset:c,initialWindowScroll:n.scroll.initial})})},qF=({state:t,published:e})=>{Hl();let n=e.modified.map(b=>{let y=t.dimensions.droppables[b.droppableId];return sg(y,b.scroll)}),o={...t.dimensions.droppables,...Z0(n)},r=Q0(YF({additions:e.additions,updatedDroppables:o,viewport:t.viewport})),i={...t.dimensions.draggables,...r};e.removals.forEach(b=>{delete i[b]});let s={droppables:o,draggables:i},a=Un(t.impact),l=a?s.droppables[a]:null,c=s.draggables[t.critical.draggable.id],d=s.droppables[t.critical.droppable.id],{impact:u,afterCritical:p}=mw({draggable:c,home:d,draggables:i,viewport:t.viewport}),f=l&&l.isCombineEnabled?t.impact:u,h=pw({pageOffset:t.current.page.offset,draggable:s.draggables[t.critical.draggable.id],draggables:s.draggables,droppables:s.droppables,previousImpact:f,viewport:t.viewport,afterCritical:p});Kl();let m={...t,phase:"DRAGGING",impact:h,onLiftImpact:u,dimensions:s,afterCritical:p,forceShouldAnimate:!1};return t.phase==="COLLECTING"?m:{...m,phase:"DROP_PENDING",reason:t.reason,isWaiting:!1}},eg=t=>t.movementMode==="SNAP",Kh=(t,e,n)=>{let o=VF(t.dimensions,e);return!eg(t)||n?Ol({state:t,dimensions:o}):gw({state:t,dimensions:o})};function Uh(t){return t.isDragging&&t.movementMode==="SNAP"?{...t,scrollJumpRequest:null}:t}var D0={phase:"IDLE",completed:null,shouldFlush:!1},JF=(t=D0,e)=>{if(e.type==="FLUSH")return{...D0,shouldFlush:!0};if(e.type==="INITIAL_PUBLISH"){t.phase!=="IDLE"&&j();let{critical:n,clientSelection:o,viewport:r,dimensions:i,movementMode:s}=e.payload,a=i.draggables[n.draggable.id],l=i.droppables[n.droppable.id],c={selection:o,borderBoxCenter:a.client.borderBox.center,offset:Kt},d={client:c,page:{selection:tn(c.selection,r.scroll.initial),borderBoxCenter:tn(c.selection,r.scroll.initial),offset:tn(c.selection,r.scroll.diff.value)}},u=Zd(i.droppables).every(m=>!m.isFixedOnPage),{impact:p,afterCritical:f}=mw({draggable:a,home:l,draggables:i.draggables,viewport:r});return{phase:"DRAGGING",isDragging:!0,critical:n,movementMode:s,dimensions:i,initial:d,current:d,isWindowScrollAllowed:u,impact:p,afterCritical:f,onLiftImpact:p,viewport:r,scrollJumpRequest:null,forceShouldAnimate:null}}if(e.type==="COLLECTION_STARTING")return t.phase==="COLLECTING"||t.phase==="DROP_PENDING"?t:(t.phase!=="DRAGGING"&&j(),{...t,phase:"COLLECTING"});if(e.type==="PUBLISH_WHILE_DRAGGING")return t.phase==="COLLECTING"||t.phase==="DROP_PENDING"||j(),qF({state:t,published:e.payload});if(e.type==="MOVE"){if(t.phase==="DROP_PENDING")return t;Vi(t)||j();let{client:n}=e.payload;return Zr(n,t.current.client.selection)?t:Ol({state:t,clientSelection:n,impact:eg(t)?t.impact:null})}if(e.type==="UPDATE_DROPPABLE_SCROLL"){if(t.phase==="DROP_PENDING"||t.phase==="COLLECTING")return Uh(t);Vi(t)||j();let{id:n,newScroll:o}=e.payload,r=t.dimensions.droppables[n];if(!r)return t;let i=sg(r,o);return Kh(t,i,!1)}if(e.type==="UPDATE_DROPPABLE_IS_ENABLED"){if(t.phase==="DROP_PENDING")return t;Vi(t)||j();let{id:n,isEnabled:o}=e.payload,r=t.dimensions.droppables[n];r||j(),r.isEnabled===o&&j();let i={...r,isEnabled:o};return Kh(t,i,!0)}if(e.type==="UPDATE_DROPPABLE_IS_COMBINE_ENABLED"){if(t.phase==="DROP_PENDING")return t;Vi(t)||j();let{id:n,isCombineEnabled:o}=e.payload,r=t.dimensions.droppables[n];r||j(),r.isCombineEnabled===o&&j();let i={...r,isCombineEnabled:o};return Kh(t,i,!0)}if(e.type==="MOVE_BY_WINDOW_SCROLL"){if(t.phase==="DROP_PENDING"||t.phase==="DROP_ANIMATING")return t;Vi(t)||j(),t.isWindowScrollAllowed||j();let n=e.payload.newScroll;if(Zr(t.viewport.scroll.current,n))return Uh(t);let o=iw(t.viewport,n);return eg(t)?gw({state:t,viewport:o}):Ol({state:t,viewport:o})}if(e.type==="UPDATE_VIEWPORT_MAX_SCROLL"){if(!Vi(t))return t;let n=e.payload.maxScroll;if(Zr(n,t.viewport.scroll.max))return t;let o={...t.viewport,scroll:{...t.viewport.scroll,max:n}};return{...t,viewport:o}}if(e.type==="MOVE_UP"||e.type==="MOVE_DOWN"||e.type==="MOVE_LEFT"||e.type==="MOVE_RIGHT"){if(t.phase==="COLLECTING"||t.phase==="DROP_PENDING")return t;t.phase!=="DRAGGING"&&j();let n=MF({state:t,type:e.type});return n?Ol({state:t,impact:n.impact,clientSelection:n.clientSelection,scrollJumpRequest:n.scrollJumpRequest}):t}if(e.type==="DROP_PENDING"){let n=e.payload.reason;return t.phase!=="COLLECTING"&&j(),{...t,phase:"DROP_PENDING",isWaiting:!0,reason:n}}if(e.type==="DROP_ANIMATE"){let{completed:n,dropDuration:o,newHomeClientOffset:r}=e.payload;return t.phase==="DRAGGING"||t.phase==="DROP_PENDING"||j(),{phase:"DROP_ANIMATING",completed:n,dropDuration:o,newHomeClientOffset:r,dimensions:t.dimensions}}if(e.type==="DROP_COMPLETE"){let{completed:n}=e.payload;return{phase:"IDLE",completed:n,shouldFlush:!1}}return t};function Ke(t,e){return t instanceof Object&&"type"in t&&t.type===e}var XF=t=>({type:"BEFORE_INITIAL_CAPTURE",payload:t}),ZF=t=>({type:"LIFT",payload:t}),QF=t=>({type:"INITIAL_PUBLISH",payload:t}),eB=t=>({type:"PUBLISH_WHILE_DRAGGING",payload:t}),tB=()=>({type:"COLLECTION_STARTING",payload:null}),nB=t=>({type:"UPDATE_DROPPABLE_SCROLL",payload:t}),oB=t=>({type:"UPDATE_DROPPABLE_IS_ENABLED",payload:t}),rB=t=>({type:"UPDATE_DROPPABLE_IS_COMBINE_ENABLED",payload:t}),_w=t=>({type:"MOVE",payload:t}),iB=t=>({type:"MOVE_BY_WINDOW_SCROLL",payload:t}),sB=t=>({type:"UPDATE_VIEWPORT_MAX_SCROLL",payload:t}),aB=()=>({type:"MOVE_UP",payload:null}),lB=()=>({type:"MOVE_DOWN",payload:null}),cB=()=>({type:"MOVE_RIGHT",payload:null}),dB=()=>({type:"MOVE_LEFT",payload:null}),fg=()=>({type:"FLUSH",payload:null}),uB=t=>({type:"DROP_ANIMATE",payload:t}),hg=t=>({type:"DROP_COMPLETE",payload:t}),bw=t=>({type:"DROP",payload:t}),pB=t=>({type:"DROP_PENDING",payload:t}),yw=()=>({type:"DROP_ANIMATION_FINISHED",payload:null});var fB=t=>({getState:e,dispatch:n})=>o=>r=>{if(!Ke(r,"LIFT")){o(r);return}let{id:i,clientSelection:s,movementMode:a}=r.payload,l=e();l.phase==="DROP_ANIMATING"&&n(hg({completed:l.completed})),e().phase!=="IDLE"&&j(),n(fg()),n(XF({draggableId:i,movementMode:a}));let d={draggableId:i,scrollOptions:{shouldPublishImmediately:a==="SNAP"}},{critical:u,dimensions:p,viewport:f}=t.startPublishing(d);n(QF({critical:u,dimensions:p,clientSelection:s,movementMode:a,viewport:f}))},hB=t=>()=>e=>n=>{Ke(n,"INITIAL_PUBLISH")&&t.dragging(),Ke(n,"DROP_ANIMATE")&&t.dropping(n.payload.completed.result.reason),(Ke(n,"FLUSH")||Ke(n,"DROP_COMPLETE"))&&t.resting(),e(n)},gg={outOfTheWay:"cubic-bezier(0.2, 0, 0, 1)",drop:"cubic-bezier(.2,1,.1,1)"},Rl={opacity:{drop:0,combining:.7},scale:{drop:.75}},xw={outOfTheWay:.2,minDropTime:.33,maxDropTime:.55},ji=`${xw.outOfTheWay}s ${gg.outOfTheWay}`,Il={fluid:`opacity ${ji}`,snap:`transform ${ji}, opacity ${ji}`,drop:t=>{let e=`${t}s ${gg.drop}`;return`transform ${e}, opacity ${e}`},outOfTheWay:`transform ${ji}`,placeholder:`height ${ji}, width ${ji}, margin ${ji}`},O0=t=>Zr(t,Kt)?void 0:`translate(${t.x}px, ${t.y}px)`,tg={moveTo:O0,drop:(t,e)=>{let n=O0(t);if(n)return e?`${n} scale(${Rl.scale.drop})`:n}},{minDropTime:ng,maxDropTime:vw}=xw,gB=vw-ng,I0=1500,mB=.6,_B=({current:t,destination:e,reason:n})=>{let o=Ml(t,e);if(o<=0)return ng;if(o>=I0)return vw;let r=o/I0,i=ng+gB*r,s=n==="CANCEL"?i*mB:i;return Number(s.toFixed(2))},bB=({impact:t,draggable:e,dimensions:n,viewport:o,afterCritical:r})=>{let{draggables:i,droppables:s}=n,a=Un(t),l=a?s[a]:null,c=s[e.descriptor.droppableId],d=hw({impact:t,draggable:e,draggables:i,afterCritical:r,droppable:l||c,viewport:o});return Kn(d,e.client.borderBox.center)},yB=({draggables:t,reason:e,lastImpact:n,home:o,viewport:r,onLiftImpact:i})=>!n.at||e!=="DROP"?{impact:fw({draggables:t,impact:i,destination:o,viewport:r,forceShouldAnimate:!0}),didDropInsideDroppable:!1}:n.at.type==="REORDER"?{impact:n,didDropInsideDroppable:!0}:{impact:{...n,displaced:Al},didDropInsideDroppable:!0},xB=({getState:t,dispatch:e})=>n=>o=>{if(!Ke(o,"DROP")){n(o);return}let r=t(),i=o.payload.reason;if(r.phase==="COLLECTING"){e(pB({reason:i}));return}if(r.phase==="IDLE")return;r.phase==="DROP_PENDING"&&r.isWaiting&&j(),r.phase==="DRAGGING"||r.phase==="DROP_PENDING"||j();let a=r.critical,l=r.dimensions,c=l.draggables[r.critical.draggable.id],{impact:d,didDropInsideDroppable:u}=yB({reason:i,lastImpact:r.impact,afterCritical:r.afterCritical,onLiftImpact:r.onLiftImpact,home:r.dimensions.droppables[r.critical.droppable.id],viewport:r.viewport,draggables:r.dimensions.draggables}),p=u?ag(d):null,f=u?Qd(d):null,h={index:a.draggable.index,droppableId:a.droppable.id},m={draggableId:c.descriptor.id,type:c.descriptor.type,source:h,reason:i,mode:r.movementMode,destination:p,combine:f},_=bB({impact:d,draggable:c,dimensions:l,viewport:r.viewport,afterCritical:r.afterCritical}),b={critical:r.critical,afterCritical:r.afterCritical,result:m,impact:d};if(!(!Zr(r.current.client.offset,_)||!!m.combine)){e(hg({completed:b}));return}let x=_B({current:r.current.client.offset,destination:_,reason:i});e(uB({newHomeClientOffset:_,dropDuration:x,completed:b}))},Cw=()=>({x:window.pageXOffset,y:window.pageYOffset});function vB(t){return{eventName:"scroll",options:{passive:!0,capture:!1},fn:e=>{e.target!==window&&e.target!==window.document||t()}}}function CB({onWindowScroll:t}){function e(){t(Cw())}let n=Qs(e),o=vB(n),r=Xr;function i(){return r!==Xr}function s(){i()&&j(),r=ro(window,[o])}function a(){i()||j(),n.cancel(),r(),r=Xr}return{start:s,stop:a,isActive:i}}var EB=t=>Ke(t,"DROP_COMPLETE")||Ke(t,"DROP_ANIMATE")||Ke(t,"FLUSH"),wB=t=>{let e=CB({onWindowScroll:n=>{t.dispatch(iB({newScroll:n}))}});return n=>o=>{!e.isActive()&&Ke(o,"INITIAL_PUBLISH")&&e.start(),e.isActive()&&EB(o)&&e.stop(),n(o)}},TB=t=>{let e=!1,n=!1,o=setTimeout(()=>{n=!0}),r=i=>{e||n||(e=!0,t(i),clearTimeout(o))};return r.wasCalled=()=>e,r},SB=()=>{let t=[],e=r=>{let i=t.findIndex(a=>a.timerId===r);i===-1&&j();let[s]=t.splice(i,1);s.callback()};return{add:r=>{let i=setTimeout(()=>e(i)),s={timerId:i,callback:r};t.push(s)},flush:()=>{if(!t.length)return;let r=[...t];t.length=0,r.forEach(i=>{clearTimeout(i.timerId),i.callback()})}}},kB=(t,e)=>t==null&&e==null?!0:t==null||e==null?!1:t.droppableId===e.droppableId&&t.index===e.index,NB=(t,e)=>t==null&&e==null?!0:t==null||e==null?!1:t.draggableId===e.draggableId&&t.droppableId===e.droppableId,DB=(t,e)=>{if(t===e)return!0;let n=t.draggable.id===e.draggable.id&&t.draggable.droppableId===e.draggable.droppableId&&t.draggable.type===e.draggable.type&&t.draggable.index===e.draggable.index,o=t.droppable.id===e.droppable.id&&t.droppable.type===e.droppable.type;return n&&o},kl=(t,e)=>{Hl(),e(),Kl()},Vd=(t,e)=>({draggableId:t.draggable.id,type:t.droppable.type,source:{droppableId:t.droppable.id,index:t.draggable.index},mode:e});function jh(t,e,n,o){if(!t){n(o(e));return}let r=TB(n);t(e,{announce:r}),r.wasCalled()||n(o(e))}var OB=(t,e)=>{let n=SB(),o=null,r=(u,p)=>{o&&j(),kl("onBeforeCapture",()=>{let f=t().onBeforeCapture;f&&f({draggableId:u,mode:p})})},i=(u,p)=>{o&&j(),kl("onBeforeDragStart",()=>{let f=t().onBeforeDragStart;f&&f(Vd(u,p))})},s=(u,p)=>{o&&j();let f=Vd(u,p);o={mode:p,lastCritical:u,lastLocation:f.source,lastCombine:null},n.add(()=>{kl("onDragStart",()=>jh(t().onDragStart,f,e,Yd.onDragStart))})},a=(u,p)=>{let f=ag(p),h=Qd(p);o||j();let m=!DB(u,o.lastCritical);m&&(o.lastCritical=u);let _=!kB(o.lastLocation,f);_&&(o.lastLocation=f);let b=!NB(o.lastCombine,h);if(b&&(o.lastCombine=h),!m&&!_&&!b)return;let y={...Vd(u,o.mode),combine:h,destination:f};n.add(()=>{kl("onDragUpdate",()=>jh(t().onDragUpdate,y,e,Yd.onDragUpdate))})},l=()=>{o||j(),n.flush()},c=u=>{o||j(),o=null,kl("onDragEnd",()=>jh(t().onDragEnd,u,e,Yd.onDragEnd))};return{beforeCapture:r,beforeStart:i,start:s,update:a,flush:l,drop:c,abort:()=>{if(!o)return;let u={...Vd(o.lastCritical,o.mode),combine:null,destination:null,reason:"CANCEL"};c(u)}}},IB=(t,e)=>{let n=OB(t,e);return o=>r=>i=>{if(Ke(i,"BEFORE_INITIAL_CAPTURE")){n.beforeCapture(i.payload.draggableId,i.payload.movementMode);return}if(Ke(i,"INITIAL_PUBLISH")){let a=i.payload.critical;n.beforeStart(a,i.payload.movementMode),r(i),n.start(a,i.payload.movementMode);return}if(Ke(i,"DROP_COMPLETE")){let a=i.payload.completed.result;n.flush(),r(i),n.drop(a);return}if(r(i),Ke(i,"FLUSH")){n.abort();return}let s=o.getState();s.phase==="DRAGGING"&&n.update(s.critical,s.impact)}},MB=t=>e=>n=>{if(!Ke(n,"DROP_ANIMATION_FINISHED")){e(n);return}let o=t.getState();o.phase!=="DROP_ANIMATING"&&j(),t.dispatch(hg({completed:o.completed}))},AB=t=>{let e=null,n=null;function o(){n&&(cancelAnimationFrame(n),n=null),e&&(e(),e=null)}return r=>i=>{if((Ke(i,"FLUSH")||Ke(i,"DROP_COMPLETE")||Ke(i,"DROP_ANIMATION_FINISHED"))&&o(),r(i),!Ke(i,"DROP_ANIMATE"))return;let s={eventName:"scroll",options:{capture:!0,passive:!1,once:!0},fn:function(){t.getState().phase==="DROP_ANIMATING"&&t.dispatch(yw())}};n=requestAnimationFrame(()=>{n=null,e=ro(window,[s])})}},LB=t=>()=>e=>n=>{(Ke(n,"DROP_COMPLETE")||Ke(n,"FLUSH")||Ke(n,"DROP_ANIMATE"))&&t.stopPublishing(),e(n)},RB=t=>{let e=!1;return()=>n=>o=>{if(Ke(o,"INITIAL_PUBLISH")){e=!0,t.tryRecordFocus(o.payload.critical.draggable.id),n(o),t.tryRestoreFocusRecorded();return}if(n(o),!!e){if(Ke(o,"FLUSH")){e=!1,t.tryRestoreFocusRecorded();return}if(Ke(o,"DROP_COMPLETE")){e=!1;let r=o.payload.completed.result;r.combine&&t.tryShiftRecord(r.draggableId,r.combine.draggableId),t.tryRestoreFocusRecorded()}}}},PB=t=>Ke(t,"DROP_COMPLETE")||Ke(t,"DROP_ANIMATE")||Ke(t,"FLUSH"),FB=t=>e=>n=>o=>{if(PB(o)){t.stop(),n(o);return}if(Ke(o,"INITIAL_PUBLISH")){n(o);let r=e.getState();r.phase!=="DRAGGING"&&j(),t.start(r);return}n(o),t.scroll(e.getState())},BB=t=>e=>n=>{if(e(n),!Ke(n,"PUBLISH_WHILE_DRAGGING"))return;let o=t.getState();o.phase==="DROP_PENDING"&&(o.isWaiting||t.dispatch(bw({reason:o.reason})))},$B=Ih,zB=({dimensionMarshal:t,focusMarshal:e,styleMarshal:n,getResponders:o,announce:r,autoScroller:i})=>Dh(JF,$B(e0(hB(n),LB(t),fB(t),xB,MB,AB,BB,FB(i),wB,RB(e),IB(o,r)))),Vh=()=>({additions:{},removals:{},modified:{}});function HB({registry:t,callbacks:e}){let n=Vh(),o=null,r=()=>{o||(e.collectionStarting(),o=requestAnimationFrame(()=>{o=null,Hl();let{additions:l,removals:c,modified:d}=n,u=Object.keys(l).map(h=>t.draggable.getById(h).getDimension(Kt)).sort((h,m)=>h.descriptor.index-m.descriptor.index),p=Object.keys(d).map(h=>{let _=t.droppable.getById(h).callbacks.getScrollWhileDragging();return{droppableId:h,scroll:_}}),f={additions:u,removals:Object.keys(c),modified:p};n=Vh(),Kl(),e.publish(f)}))};return{add:l=>{let c=l.descriptor.id;n.additions[c]=l,n.modified[l.descriptor.droppableId]=!0,n.removals[c]&&delete n.removals[c],r()},remove:l=>{let c=l.descriptor;n.removals[c.id]=!0,n.modified[c.droppableId]=!0,n.additions[c.id]&&delete n.additions[c.id],r()},stop:()=>{o&&(cancelAnimationFrame(o),o=null,n=Vh())}}}var Ew=({scrollHeight:t,scrollWidth:e,height:n,width:o})=>{let r=Kn({x:e,y:t},{x:o,y:n});return{x:Math.max(0,r.x),y:Math.max(0,r.y)}},ww=()=>{let t=document.documentElement;return t||j(),t},Tw=()=>{let t=ww();return Ew({scrollHeight:t.scrollHeight,scrollWidth:t.scrollWidth,width:t.clientWidth,height:t.clientHeight})},KB=()=>{let t=Cw(),e=Tw(),n=t.y,o=t.x,r=ww(),i=r.clientWidth,s=r.clientHeight,a=o+i,l=n+s;return{frame:oo({top:n,left:o,right:a,bottom:l}),scroll:{initial:t,current:t,max:e,diff:{value:Kt,displacement:Kt}}}},UB=({critical:t,scrollOptions:e,registry:n})=>{Hl();let o=KB(),r=o.scroll.current,i=t.droppable,s=n.droppable.getAllByType(i.type).map(d=>d.callbacks.getDimensionAndWatchScroll(r,e)),a=n.draggable.getAllByType(t.draggable.type).map(d=>d.getDimension(r)),l={draggables:Q0(a),droppables:Z0(s)};return Kl(),{dimensions:l,critical:t,viewport:o}};function M0(t,e,n){return!(n.descriptor.id===e.id||n.descriptor.type!==e.type||t.droppable.getById(n.descriptor.droppableId).descriptor.mode!=="virtual")}var jB=(t,e)=>{let n=null,o=HB({callbacks:{publish:e.publishWhileDragging,collectionStarting:e.collectionStarting},registry:t}),r=(p,f)=>{t.droppable.exists(p)||j(),n&&e.updateDroppableIsEnabled({id:p,isEnabled:f})},i=(p,f)=>{n&&(t.droppable.exists(p)||j(),e.updateDroppableIsCombineEnabled({id:p,isCombineEnabled:f}))},s=(p,f)=>{n&&(t.droppable.exists(p)||j(),e.updateDroppableScroll({id:p,newScroll:f}))},a=(p,f)=>{n&&t.droppable.getById(p).callbacks.scroll(f)},l=()=>{if(!n)return;o.stop();let p=n.critical.droppable;t.droppable.getAllByType(p.type).forEach(f=>f.callbacks.dragStopped()),n.unsubscribe(),n=null},c=p=>{n||j();let f=n.critical.draggable;p.type==="ADDITION"&&M0(t,f,p.value)&&o.add(p.value),p.type==="REMOVAL"&&M0(t,f,p.value)&&o.remove(p.value)};return{updateDroppableIsEnabled:r,updateDroppableIsCombineEnabled:i,scrollDroppable:a,updateDroppableScroll:s,startPublishing:p=>{n&&j();let f=t.draggable.getById(p.draggableId),h=t.droppable.getById(f.descriptor.droppableId),m={draggable:f.descriptor,droppable:h.descriptor},_=t.subscribe(c);return n={critical:m,unsubscribe:_},UB({critical:m,registry:t,scrollOptions:p.scrollOptions})},stopPublishing:l}},Sw=(t,e)=>t.phase==="IDLE"?!0:t.phase!=="DROP_ANIMATING"||t.completed.result.draggableId===e?!1:t.completed.result.reason==="DROP",VB=t=>{window.scrollBy(t.x,t.y)},WB=Ht(t=>Zd(t).filter(e=>!(!e.isEnabled||!e.frame))),GB=(t,e)=>WB(e).find(o=>(o.frame||j(),cw(o.frame.pageMarginBox)(t)))||null,YB=({center:t,destination:e,droppables:n})=>{if(e){let r=n[e];return r.frame?r:null}return GB(t,n)},Pl={startFromPercentage:.25,maxScrollAtPercentage:.05,maxPixelScroll:28,ease:t=>t**2,durationDampening:{stopDampeningAt:1200,accelerateAt:360},disabled:!1},qB=(t,e,n=()=>Pl)=>{let o=n(),r=t[e.size]*o.startFromPercentage,i=t[e.size]*o.maxScrollAtPercentage;return{startScrollingFrom:r,maxScrollValueAt:i}},kw=({startOfRange:t,endOfRange:e,current:n})=>{let o=e-t;return o===0?0:(n-t)/o},mg=1,JB=(t,e,n=()=>Pl)=>{let o=n();if(t>e.startScrollingFrom)return 0;if(t<=e.maxScrollValueAt)return o.maxPixelScroll;if(t===e.startScrollingFrom)return mg;let i=1-kw({startOfRange:e.maxScrollValueAt,endOfRange:e.startScrollingFrom,current:t}),s=o.maxPixelScroll*o.ease(i);return Math.ceil(s)},XB=(t,e,n)=>{let o=n(),r=o.durationDampening.accelerateAt,i=o.durationDampening.stopDampeningAt,s=e,a=i,c=Date.now()-s;if(c>=i)return t;if(c<r)return mg;let d=kw({startOfRange:r,endOfRange:a,current:c}),u=t*o.ease(d);return Math.ceil(u)},A0=({distanceToEdge:t,thresholds:e,dragStartTime:n,shouldUseTimeDampening:o,getAutoScrollerOptions:r})=>{let i=JB(t,e,r);return i===0?0:o?Math.max(XB(i,n,r),mg):i},L0=({container:t,distanceToEdges:e,dragStartTime:n,axis:o,shouldUseTimeDampening:r,getAutoScrollerOptions:i})=>{let s=qB(t,o,i);return e[o.end]<e[o.start]?A0({distanceToEdge:e[o.end],thresholds:s,dragStartTime:n,shouldUseTimeDampening:r,getAutoScrollerOptions:i}):-1*A0({distanceToEdge:e[o.start],thresholds:s,dragStartTime:n,shouldUseTimeDampening:r,getAutoScrollerOptions:i})},ZB=({container:t,subject:e,proposedScroll:n})=>{let o=e.height>t.height,r=e.width>t.width;return!r&&!o?n:r&&o?null:{x:r?0:n.x,y:o?0:n.y}},QB=X0(t=>t===0?0:t),Nw=({dragStartTime:t,container:e,subject:n,center:o,shouldUseTimeDampening:r,getAutoScrollerOptions:i})=>{let s={top:o.y-e.top,right:e.right-o.x,bottom:e.bottom-o.y,left:o.x-e.left},a=L0({container:e,distanceToEdges:s,dragStartTime:t,axis:lg,shouldUseTimeDampening:r,getAutoScrollerOptions:i}),l=L0({container:e,distanceToEdges:s,dragStartTime:t,axis:nw,shouldUseTimeDampening:r,getAutoScrollerOptions:i}),c=QB({x:l,y:a});if(Zr(c,Kt))return null;let d=ZB({container:e,subject:n,proposedScroll:c});return d?Zr(d,Kt)?null:d:null},e2=X0(t=>t===0?0:t>0?1:-1),_g=(()=>{let t=(e,n)=>e<0?e:e>n?e-n:0;return({current:e,max:n,change:o})=>{let r=tn(e,o),i={x:t(r.x,n.x),y:t(r.y,n.y)};return Zr(i,Kt)?null:i}})(),Dw=({max:t,current:e,change:n})=>{let o={x:Math.max(e.x,t.x),y:Math.max(e.y,t.y)},r=e2(n),i=_g({max:o,current:e,change:r});return!i||r.x!==0&&i.x===0||r.y!==0&&i.y===0},bg=(t,e)=>Dw({current:t.scroll.current,max:t.scroll.max,change:e}),t2=(t,e)=>{if(!bg(t,e))return null;let n=t.scroll.max,o=t.scroll.current;return _g({current:o,max:n,change:e})},yg=(t,e)=>{let n=t.frame;return n?Dw({current:n.scroll.current,max:n.scroll.max,change:e}):!1},n2=(t,e)=>{let n=t.frame;return!n||!yg(t,e)?null:_g({current:n.scroll.current,max:n.scroll.max,change:e})},o2=({viewport:t,subject:e,center:n,dragStartTime:o,shouldUseTimeDampening:r,getAutoScrollerOptions:i})=>{let s=Nw({dragStartTime:o,container:t.frame,subject:e,center:n,shouldUseTimeDampening:r,getAutoScrollerOptions:i});return s&&bg(t,s)?s:null},r2=({droppable:t,subject:e,center:n,dragStartTime:o,shouldUseTimeDampening:r,getAutoScrollerOptions:i})=>{let s=t.frame;if(!s)return null;let a=Nw({dragStartTime:o,container:s.pageMarginBox,subject:e,center:n,shouldUseTimeDampening:r,getAutoScrollerOptions:i});return a&&yg(t,a)?a:null},R0=({state:t,dragStartTime:e,shouldUseTimeDampening:n,scrollWindow:o,scrollDroppable:r,getAutoScrollerOptions:i})=>{let s=t.current.page.borderBoxCenter,l=t.dimensions.draggables[t.critical.draggable.id].page.marginBox;if(t.isWindowScrollAllowed){let u=t.viewport,p=o2({dragStartTime:e,viewport:u,subject:l,center:s,shouldUseTimeDampening:n,getAutoScrollerOptions:i});if(p){o(p);return}}let c=YB({center:s,destination:Un(t.impact),droppables:t.dimensions.droppables});if(!c)return;let d=r2({dragStartTime:e,droppable:c,subject:l,center:s,shouldUseTimeDampening:n,getAutoScrollerOptions:i});d&&r(c.descriptor.id,d)},i2=({scrollWindow:t,scrollDroppable:e,getAutoScrollerOptions:n=()=>Pl})=>{let o=Qs(t),r=Qs(e),i=null,s=c=>{i||j();let{shouldUseTimeDampening:d,dragStartTime:u}=i;R0({state:c,scrollWindow:o,scrollDroppable:r,dragStartTime:u,shouldUseTimeDampening:d,getAutoScrollerOptions:n})};return{start:c=>{Hl(),i&&j();let d=Date.now(),u=!1,p=()=>{u=!0};R0({state:c,dragStartTime:0,shouldUseTimeDampening:!1,scrollWindow:p,scrollDroppable:p,getAutoScrollerOptions:n}),i={dragStartTime:d,shouldUseTimeDampening:u},Kl(),u&&s(c)},stop:()=>{i&&(o.cancel(),r.cancel(),i=null)},scroll:s}},s2=({move:t,scrollDroppable:e,scrollWindow:n})=>{let o=(a,l)=>{let c=tn(a.current.client.selection,l);t({client:c})},r=(a,l)=>{if(!yg(a,l))return l;let c=n2(a,l);if(!c)return e(a.descriptor.id,l),null;let d=Kn(l,c);return e(a.descriptor.id,d),Kn(l,d)},i=(a,l,c)=>{if(!a||!bg(l,c))return c;let d=t2(l,c);if(!d)return n(c),null;let u=Kn(c,d);return n(u),Kn(c,u)};return a=>{let l=a.scrollJumpRequest;if(!l)return;let c=Un(a.impact);c||j();let d=r(a.dimensions.droppables[c],l);if(!d)return;let u=a.viewport,p=i(a.isWindowScrollAllowed,u,d);p&&o(a,p)}},a2=({scrollDroppable:t,scrollWindow:e,move:n,getAutoScrollerOptions:o})=>{let r=i2({scrollWindow:e,scrollDroppable:t,getAutoScrollerOptions:o}),i=s2({move:n,scrollWindow:e,scrollDroppable:t});return{scroll:l=>{if(!(o().disabled||l.phase!=="DRAGGING")){if(l.movementMode==="FLUID"){r.scroll(l);return}l.scrollJumpRequest&&i(l)}},start:r.start,stop:r.stop}},ta="data-rfd",na=(()=>{let t=`${ta}-drag-handle`;return{base:t,draggableId:`${t}-draggable-id`,contextId:`${t}-context-id`}})(),og=(()=>{let t=`${ta}-draggable`;return{base:t,contextId:`${t}-context-id`,id:`${t}-id`}})(),l2=(()=>{let t=`${ta}-droppable`;return{base:t,contextId:`${t}-context-id`,id:`${t}-id`}})(),P0={contextId:`${ta}-scroll-container-context-id`},c2=t=>e=>`[${e}="${t}"]`,Nl=(t,e)=>t.map(n=>{let o=n.styles[e];return o?`${n.selector} { ${o} }`:""}).join(" "),d2="pointer-events: none;",u2=t=>{let e=c2(t),n=(()=>{let a=`
|
|
65
|
-
cursor: -webkit-grab;
|
|
66
|
-
cursor: grab;
|
|
67
|
-
`;return{selector:e(na.contextId),styles:{always:`
|
|
68
|
-
-webkit-touch-callout: none;
|
|
69
|
-
-webkit-tap-highlight-color: rgba(0,0,0,0);
|
|
70
|
-
touch-action: manipulation;
|
|
71
|
-
`,resting:a,dragging:d2,dropAnimating:a}}})(),o=(()=>{let a=`
|
|
72
|
-
transition: ${Il.outOfTheWay};
|
|
73
|
-
`;return{selector:e(og.contextId),styles:{dragging:a,dropAnimating:a,userCancel:a}}})(),r={selector:e(l2.contextId),styles:{always:"overflow-anchor: none;"}},s=[o,n,r,{selector:"body",styles:{dragging:`
|
|
74
|
-
cursor: grabbing;
|
|
75
|
-
cursor: -webkit-grabbing;
|
|
76
|
-
user-select: none;
|
|
77
|
-
-webkit-user-select: none;
|
|
78
|
-
-moz-user-select: none;
|
|
79
|
-
-ms-user-select: none;
|
|
80
|
-
overflow-anchor: none;
|
|
81
|
-
`}}];return{always:Nl(s,"always"),resting:Nl(s,"resting"),dragging:Nl(s,"dragging"),dropAnimating:Nl(s,"dropAnimating"),userCancel:Nl(s,"userCancel")}},jn=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?un:P,Wh=()=>{let t=document.querySelector("head");return t||j(),t},F0=t=>{let e=document.createElement("style");return t&&e.setAttribute("nonce",t),e.type="text/css",e};function p2(t,e){let n=Le(()=>u2(t),[t]),o=Y(null),r=Y(null),i=ae(Ht(u=>{let p=r.current;p||j(),p.textContent=u}),[]),s=ae(u=>{let p=o.current;p||j(),p.textContent=u},[]);jn(()=>{!o.current&&!r.current||j();let u=F0(e),p=F0(e);return o.current=u,r.current=p,u.setAttribute(`${ta}-always`,t),p.setAttribute(`${ta}-dynamic`,t),Wh().appendChild(u),Wh().appendChild(p),s(n.always),i(n.resting),()=>{let f=h=>{let m=h.current;m||j(),Wh().removeChild(m),h.current=null};f(o),f(r)}},[e,s,i,n.always,n.resting,t]);let a=ae(()=>i(n.dragging),[i,n.dragging]),l=ae(u=>{if(u==="DROP"){i(n.dropAnimating);return}i(n.userCancel)},[i,n.dropAnimating,n.userCancel]),c=ae(()=>{r.current&&i(n.resting)},[i,n.resting]);return Le(()=>({dragging:a,dropping:l,resting:c}),[a,l,c])}function Ow(t,e){return Array.from(t.querySelectorAll(e))}var Iw=t=>t&&t.ownerDocument&&t.ownerDocument.defaultView?t.ownerDocument.defaultView:window;function Ul(t){return t instanceof Iw(t).HTMLElement}function Mw(t,e){let n=`[${na.contextId}="${t}"]`,o=Ow(document,n);if(!o.length)return null;let r=o.find(i=>i.getAttribute(na.draggableId)===e);return!r||!Ul(r)?null:r}function f2(t){let e=Y({}),n=Y(null),o=Y(null),r=Y(!1),i=ae(function(p,f){let h={id:p,focus:f};return e.current[p]=h,function(){let _=e.current;_[p]!==h&&delete _[p]}},[]),s=ae(function(p){let f=Mw(t,p);f&&f!==document.activeElement&&f.focus()},[t]),a=ae(function(p,f){n.current===p&&(n.current=f)},[]),l=ae(function(){o.current||r.current&&(o.current=requestAnimationFrame(()=>{o.current=null;let p=n.current;p&&s(p)}))},[s]),c=ae(function(p){n.current=null;let f=document.activeElement;f&&f.getAttribute(na.draggableId)===p&&(n.current=p)},[]);return jn(()=>(r.current=!0,function(){r.current=!1;let p=o.current;p&&cancelAnimationFrame(p)}),[]),Le(()=>({register:i,tryRecordFocus:c,tryRestoreFocusRecorded:l,tryShiftRecord:a}),[i,c,l,a])}function h2(){let t={draggables:{},droppables:{}},e=[];function n(u){return e.push(u),function(){let f=e.indexOf(u);f!==-1&&e.splice(f,1)}}function o(u){e.length&&e.forEach(p=>p(u))}function r(u){return t.draggables[u]||null}function i(u){let p=r(u);return p||j(),p}let s={register:u=>{t.draggables[u.descriptor.id]=u,o({type:"ADDITION",value:u})},update:(u,p)=>{let f=t.draggables[p.descriptor.id];f&&f.uniqueId===u.uniqueId&&(delete t.draggables[p.descriptor.id],t.draggables[u.descriptor.id]=u)},unregister:u=>{let p=u.descriptor.id,f=r(p);f&&u.uniqueId===f.uniqueId&&(delete t.draggables[p],t.droppables[u.descriptor.droppableId]&&o({type:"REMOVAL",value:u}))},getById:i,findById:r,exists:u=>!!r(u),getAllByType:u=>Object.values(t.draggables).filter(p=>p.descriptor.type===u)};function a(u){return t.droppables[u]||null}function l(u){let p=a(u);return p||j(),p}let c={register:u=>{t.droppables[u.descriptor.id]=u},unregister:u=>{let p=a(u.descriptor.id);p&&u.uniqueId===p.uniqueId&&delete t.droppables[u.descriptor.id]},getById:l,findById:a,exists:u=>!!a(u),getAllByType:u=>Object.values(t.droppables).filter(p=>p.descriptor.type===u)};function d(){t.draggables={},t.droppables={},e.length=0}return{draggable:s,droppable:c,subscribe:n,clean:d}}function g2(){let t=Le(h2,[]);return P(()=>function(){t.clean()},[t]),t}var xg=et.createContext(null),Fl=()=>{let t=document.body;return t||j(),t},m2={position:"absolute",width:"1px",height:"1px",margin:"-1px",border:"0",padding:"0",overflow:"hidden",clip:"rect(0 0 0 0)","clip-path":"inset(100%)"},_2=t=>`rfd-announcement-${t}`;function b2(t){let e=Le(()=>_2(t),[t]),n=Y(null);return P(function(){let i=document.createElement("div");return n.current=i,i.id=e,i.setAttribute("aria-live","assertive"),i.setAttribute("aria-atomic","true"),nh(i.style,m2),Fl().appendChild(i),function(){setTimeout(function(){let l=Fl();l.contains(i)&&l.removeChild(i),i===n.current&&(n.current=null)})}},[e]),ae(r=>{let i=n.current;if(i){i.textContent=r;return}},[])}var y2={separator:"::"};function vg(t,e=y2){let n=et.useId();return Le(()=>`${t}${e.separator}${n}`,[e.separator,t,n])}function x2({contextId:t,uniqueId:e}){return`rfd-hidden-text-${t}-${e}`}function v2({contextId:t,text:e}){let n=vg("hidden-text",{separator:"-"}),o=Le(()=>x2({contextId:t,uniqueId:n}),[n,t]);return P(function(){let i=document.createElement("div");return i.id=o,i.textContent=e,i.style.display="none",Fl().appendChild(i),function(){let a=Fl();a.contains(i)&&a.removeChild(i)}},[o,e]),o}var nu=et.createContext(null),C2={react:"^18.0.0 || ^19.0.0"},E2=/(\d+)\.(\d+)\.(\d+)/,B0=t=>{let e=E2.exec(t);e==null&&j();let n=Number(e[1]),o=Number(e[2]),r=Number(e[3]);return{major:n,minor:o,patch:r,raw:t}},w2=(t,e)=>e.major>t.major?!0:e.major<t.major?!1:e.minor>t.minor?!0:e.minor<t.minor?!1:e.patch>=t.patch,T2=(t,e)=>{let n=B0(t),o=B0(e);w2(n,o)};var S2=t=>{let e=t.doctype;e&&(e.name.toLowerCase(),e.publicId)};function jl(t,e){}function k2(){jl(()=>{T2(C2.react,et.version),S2(document)},[])}function Cg(t){let e=Y(t);return P(()=>{e.current=t}),e}function N2(){let t=null;function e(){return!!t}function n(s){return s===t}function o(s){t&&j();let a={abandon:s};return t=a,a}function r(){t||j(),t=null}function i(){t&&(t.abandon(),r())}return{isClaimed:e,isActive:n,claim:o,release:r,tryAbandon:i}}function Bl(t){return t.phase==="IDLE"||t.phase==="DROP_ANIMATING"?!1:t.isDragging}var D2=9,O2=13,Eg=27,Aw=32,I2=33,M2=34,A2=35,L2=36,R2=37,P2=38,F2=39,B2=40,$2={[O2]:!0,[D2]:!0},Lw=t=>{$2[t.keyCode]&&t.preventDefault()},ou=(()=>{let t="visibilitychange";return typeof document>"u"?t:[t,`ms${t}`,`webkit${t}`,`moz${t}`,`o${t}`].find(o=>`on${o}`in document)||t})(),Rw=0,$0=5;function z2(t,e){return Math.abs(e.x-t.x)>=$0||Math.abs(e.y-t.y)>=$0}var z0={type:"IDLE"};function H2({cancel:t,completed:e,getPhase:n,setPhase:o}){return[{eventName:"mousemove",fn:r=>{let{button:i,clientX:s,clientY:a}=r;if(i!==Rw)return;let l={x:s,y:a},c=n();if(c.type==="DRAGGING"){r.preventDefault(),c.actions.move(l);return}c.type!=="PENDING"&&j();let d=c.point;if(!z2(d,l))return;r.preventDefault();let u=c.actions.fluidLift(l);o({type:"DRAGGING",actions:u})}},{eventName:"mouseup",fn:r=>{let i=n();if(i.type!=="DRAGGING"){t();return}r.preventDefault(),i.actions.drop({shouldBlockNextClick:!0}),e()}},{eventName:"mousedown",fn:r=>{n().type==="DRAGGING"&&r.preventDefault(),t()}},{eventName:"keydown",fn:r=>{if(n().type==="PENDING"){t();return}if(r.keyCode===Eg){r.preventDefault(),t();return}Lw(r)}},{eventName:"resize",fn:t},{eventName:"scroll",options:{passive:!0,capture:!1},fn:()=>{n().type==="PENDING"&&t()}},{eventName:"webkitmouseforcedown",fn:r=>{let i=n();if(i.type==="IDLE"&&j(),i.actions.shouldRespectForcePress()){t();return}r.preventDefault()}},{eventName:ou,fn:t}]}function K2(t){let e=Y(z0),n=Y(Xr),o=Le(()=>({eventName:"mousedown",fn:function(u){if(u.defaultPrevented||u.button!==Rw||u.ctrlKey||u.metaKey||u.shiftKey||u.altKey)return;let p=t.findClosestDraggableId(u);if(!p)return;let f=t.tryGetLock(p,s,{sourceEvent:u});if(!f)return;u.preventDefault();let h={x:u.clientX,y:u.clientY};n.current(),c(f,h)}}),[t]),r=Le(()=>({eventName:"webkitmouseforcewillbegin",fn:d=>{if(d.defaultPrevented)return;let u=t.findClosestDraggableId(d);if(!u)return;let p=t.findOptionsForDraggable(u);p&&(p.shouldRespectForcePress||t.canGetLock(u)&&d.preventDefault())}}),[t]),i=ae(function(){let u={passive:!1,capture:!0};n.current=ro(window,[r,o],u)},[r,o]),s=ae(()=>{e.current.type!=="IDLE"&&(e.current=z0,n.current(),i())},[i]),a=ae(()=>{let d=e.current;s(),d.type==="DRAGGING"&&d.actions.cancel({shouldBlockNextClick:!0}),d.type==="PENDING"&&d.actions.abort()},[s]),l=ae(function(){let u={capture:!0,passive:!1},p=H2({cancel:a,completed:s,getPhase:()=>e.current,setPhase:f=>{e.current=f}});n.current=ro(window,p,u)},[a,s]),c=ae(function(u,p){e.current.type!=="IDLE"&&j(),e.current={type:"PENDING",point:p,actions:u},l()},[l]);jn(function(){return i(),function(){n.current()}},[i])}function U2(){}var j2={[M2]:!0,[I2]:!0,[L2]:!0,[A2]:!0};function V2(t,e){function n(){e(),t.cancel()}function o(){e(),t.drop()}return[{eventName:"keydown",fn:r=>{if(r.keyCode===Eg){r.preventDefault(),n();return}if(r.keyCode===Aw){r.preventDefault(),o();return}if(r.keyCode===B2){r.preventDefault(),t.moveDown();return}if(r.keyCode===P2){r.preventDefault(),t.moveUp();return}if(r.keyCode===F2){r.preventDefault(),t.moveRight();return}if(r.keyCode===R2){r.preventDefault(),t.moveLeft();return}if(j2[r.keyCode]){r.preventDefault();return}Lw(r)}},{eventName:"mousedown",fn:n},{eventName:"mouseup",fn:n},{eventName:"click",fn:n},{eventName:"touchstart",fn:n},{eventName:"resize",fn:n},{eventName:"wheel",fn:n,options:{passive:!0}},{eventName:ou,fn:n}]}function W2(t){let e=Y(U2),n=Le(()=>({eventName:"keydown",fn:function(i){if(i.defaultPrevented||i.keyCode!==Aw)return;let s=t.findClosestDraggableId(i);if(!s)return;let a=t.tryGetLock(s,d,{sourceEvent:i});if(!a)return;i.preventDefault();let l=!0,c=a.snapLift();e.current();function d(){l||j(),l=!1,e.current(),o()}e.current=ro(window,V2(c,d),{capture:!0,passive:!1})}}),[t]),o=ae(function(){let i={passive:!1,capture:!0};e.current=ro(window,[n],i)},[n]);jn(function(){return o(),function(){e.current()}},[o])}var Gh={type:"IDLE"},G2=120,Y2=.15;function q2({cancel:t,getPhase:e}){return[{eventName:"orientationchange",fn:t},{eventName:"resize",fn:t},{eventName:"contextmenu",fn:n=>{n.preventDefault()}},{eventName:"keydown",fn:n=>{if(e().type!=="DRAGGING"){t();return}n.keyCode===Eg&&n.preventDefault(),t()}},{eventName:ou,fn:t}]}function J2({cancel:t,completed:e,getPhase:n}){return[{eventName:"touchmove",options:{capture:!1},fn:o=>{let r=n();if(r.type!=="DRAGGING"){t();return}r.hasMoved=!0;let{clientX:i,clientY:s}=o.touches[0],a={x:i,y:s};o.preventDefault(),r.actions.move(a)}},{eventName:"touchend",fn:o=>{let r=n();if(r.type!=="DRAGGING"){t();return}o.preventDefault(),r.actions.drop({shouldBlockNextClick:!0}),e()}},{eventName:"touchcancel",fn:o=>{if(n().type!=="DRAGGING"){t();return}o.preventDefault(),t()}},{eventName:"touchforcechange",fn:o=>{let r=n();r.type==="IDLE"&&j();let i=o.touches[0];if(!i||!(i.force>=Y2))return;let a=r.actions.shouldRespectForcePress();if(r.type==="PENDING"){a&&t();return}if(a){if(r.hasMoved){o.preventDefault();return}t();return}o.preventDefault()}},{eventName:ou,fn:t}]}function X2(t){let e=Y(Gh),n=Y(Xr),o=ae(function(){return e.current},[]),r=ae(function(f){e.current=f},[]),i=Le(()=>({eventName:"touchstart",fn:function(f){if(f.defaultPrevented)return;let h=t.findClosestDraggableId(f);if(!h)return;let m=t.tryGetLock(h,a,{sourceEvent:f});if(!m)return;let _=f.touches[0],{clientX:b,clientY:y}=_,x={x:b,y};n.current(),u(m,x)}}),[t]),s=ae(function(){let f={capture:!0,passive:!1};n.current=ro(window,[i],f)},[i]),a=ae(()=>{let p=e.current;p.type!=="IDLE"&&(p.type==="PENDING"&&clearTimeout(p.longPressTimerId),r(Gh),n.current(),s())},[s,r]),l=ae(()=>{let p=e.current;a(),p.type==="DRAGGING"&&p.actions.cancel({shouldBlockNextClick:!0}),p.type==="PENDING"&&p.actions.abort()},[a]),c=ae(function(){let f={capture:!0,passive:!1},h={cancel:l,completed:a,getPhase:o},m=ro(window,J2(h),f),_=ro(window,q2(h),f);n.current=function(){m(),_()}},[l,o,a]),d=ae(function(){let f=o();f.type!=="PENDING"&&j();let h=f.actions.fluidLift(f.point);r({type:"DRAGGING",actions:h,hasMoved:!1})},[o,r]),u=ae(function(f,h){o().type!=="IDLE"&&j();let m=setTimeout(d,G2);r({type:"PENDING",point:h,actions:f,longPressTimerId:m}),c()},[c,o,r,d]);jn(function(){return s(),function(){n.current();let h=o();h.type==="PENDING"&&(clearTimeout(h.longPressTimerId),r(Gh))}},[o,s,r]),jn(function(){return ro(window,[{eventName:"touchmove",fn:()=>{},options:{capture:!1,passive:!1}}])},[])}function Z2(t){}var Q2=["input","button","textarea","select","option","optgroup","video","audio"];function Pw(t,e){if(e==null)return!1;if(Q2.includes(e.tagName.toLowerCase()))return!0;let o=e.getAttribute("contenteditable");return o==="true"||o===""?!0:e===t?!1:Pw(t,e.parentElement)}function e$(t,e){let n=e.target;return Ul(n)?Pw(t,n):!1}var t$=t=>oo(t.getBoundingClientRect()).center;function n$(t){return t instanceof Iw(t).Element}var o$=(()=>{let t="matches";return typeof document>"u"?t:[t,"msMatchesSelector","webkitMatchesSelector"].find(o=>o in Element.prototype)||t})();function Fw(t,e){return t==null?null:t[o$](e)?t:Fw(t.parentElement,e)}function r$(t,e){return t.closest?t.closest(e):Fw(t,e)}function i$(t){return`[${na.contextId}="${t}"]`}function s$(t,e){let n=e.target;if(!n$(n))return null;let o=i$(t),r=r$(n,o);return!r||!Ul(r)?null:r}function a$(t,e){let n=s$(t,e);return n?n.getAttribute(na.draggableId):null}function l$(t,e){let n=`[${og.contextId}="${t}"]`,r=Ow(document,n).find(i=>i.getAttribute(og.id)===e);return!r||!Ul(r)?null:r}function c$(t){t.preventDefault()}function Wd({expected:t,phase:e,isLockActive:n,shouldWarn:o}){return!(!n()||t!==e)}function Bw({lockAPI:t,store:e,registry:n,draggableId:o}){if(t.isClaimed())return!1;let r=n.draggable.findById(o);return!(!r||!r.options.isEnabled||!Sw(e.getState(),o))}function d$({lockAPI:t,contextId:e,store:n,registry:o,draggableId:r,forceSensorStop:i,sourceEvent:s}){if(!Bw({lockAPI:t,store:n,registry:o,draggableId:r}))return null;let l=o.draggable.getById(r),c=l$(e,l.descriptor.id);if(!c||s&&!l.options.canDragInteractiveElements&&e$(c,s))return null;let d=t.claim(i||Xr),u="PRE_DRAG";function p(){return l.options.shouldRespectForcePress}function f(){return t.isActive(d)}function h(E,C){Wd({expected:E,phase:u,isLockActive:f,shouldWarn:!0})&&n.dispatch(C())}let m=h.bind(null,"DRAGGING");function _(E){function C(){t.release(),u="COMPLETED"}u!=="PRE_DRAG"&&(C(),j()),n.dispatch(ZF(E.liftActionArgs)),u="DRAGGING";function k(T,w={shouldBlockNextClick:!1}){if(E.cleanup(),w.shouldBlockNextClick){let S=ro(window,[{eventName:"click",fn:c$,options:{once:!0,passive:!1,capture:!0}}]);setTimeout(S)}C(),n.dispatch(bw({reason:T}))}return{isActive:()=>Wd({expected:"DRAGGING",phase:u,isLockActive:f,shouldWarn:!1}),shouldRespectForcePress:p,drop:T=>k("DROP",T),cancel:T=>k("CANCEL",T),...E.actions}}function b(E){let C=Qs(T=>{m(()=>_w({client:T}))});return{..._({liftActionArgs:{id:r,clientSelection:E,movementMode:"FLUID"},cleanup:()=>C.cancel(),actions:{move:C}}),move:C}}function y(){let E={moveUp:()=>m(aB),moveRight:()=>m(cB),moveDown:()=>m(lB),moveLeft:()=>m(dB)};return _({liftActionArgs:{id:r,clientSelection:t$(c),movementMode:"SNAP"},cleanup:Xr,actions:E})}function x(){Wd({expected:"PRE_DRAG",phase:u,isLockActive:f,shouldWarn:!0})&&t.release()}return{isActive:()=>Wd({expected:"PRE_DRAG",phase:u,isLockActive:f,shouldWarn:!1}),shouldRespectForcePress:p,fluidLift:b,snapLift:y,abort:x}}var u$=[K2,W2,X2];function p$({contextId:t,store:e,registry:n,customSensors:o,enableDefaultSensors:r}){let i=[...r?u$:[],...o||[]],s=R(()=>N2())[0],a=ae(function(_,b){Bl(_)&&!Bl(b)&&s.tryAbandon()},[s]);jn(function(){let _=e.getState();return e.subscribe(()=>{let y=e.getState();a(_,y),_=y})},[s,e,a]),jn(()=>s.tryAbandon,[s.tryAbandon]);let l=ae(m=>Bw({lockAPI:s,registry:n,store:e,draggableId:m}),[s,n,e]),c=ae((m,_,b)=>d$({lockAPI:s,registry:n,contextId:t,store:e,draggableId:m,forceSensorStop:_||null,sourceEvent:b&&b.sourceEvent?b.sourceEvent:null}),[t,s,n,e]),d=ae(m=>a$(t,m),[t]),u=ae(m=>{let _=n.draggable.findById(m);return _?_.options:null},[n.draggable]),p=ae(function(){s.isClaimed()&&(s.tryAbandon(),e.getState().phase!=="IDLE"&&e.dispatch(fg()))},[s,e]),f=ae(()=>s.isClaimed(),[s]),h=Le(()=>({canGetLock:l,tryGetLock:c,findClosestDraggableId:d,findOptionsForDraggable:u,tryReleaseLock:p,isLockClaimed:f}),[l,c,d,u,p,f]);Z2(i);for(let m=0;m<i.length;m++)i[m](h)}var f$=t=>({onBeforeCapture:e=>{vl(()=>{t.onBeforeCapture&&t.onBeforeCapture(e)})},onBeforeDragStart:t.onBeforeDragStart,onDragStart:t.onDragStart,onDragEnd:t.onDragEnd,onDragUpdate:t.onDragUpdate}),h$=t=>({...Pl,...t.autoScrollerOptions,durationDampening:{...Pl.durationDampening,...t.autoScrollerOptions}});function Dl(t){return t.current||j(),t.current}function g$(t){let{contextId:e,setCallbacks:n,sensors:o,nonce:r,dragHandleUsageInstructions:i}=t,s=Y(null);k2();let a=Cg(t),l=ae(()=>f$(a.current),[a]),c=ae(()=>h$(a.current),[a]),d=b2(e),u=v2({contextId:e,text:i}),p=p2(e,r),f=ae(S=>{Dl(s).dispatch(S)},[]),h=Le(()=>Oh({publishWhileDragging:eB,updateDroppableScroll:nB,updateDroppableIsEnabled:oB,updateDroppableIsCombineEnabled:rB,collectionStarting:tB},f),[f]),m=g2(),_=Le(()=>jB(m,h),[m,h]),b=Le(()=>a2({scrollWindow:VB,scrollDroppable:_.scrollDroppable,getAutoScrollerOptions:c,...Oh({move:_w},f)}),[_.scrollDroppable,f,c]),y=f2(e),x=Le(()=>zB({announce:d,autoScroller:b,dimensionMarshal:_,focusMarshal:y,getResponders:l,styleMarshal:p}),[d,b,_,y,l,p]);s.current=x;let v=ae(()=>{let S=Dl(s);S.getState().phase!=="IDLE"&&S.dispatch(fg())},[]),E=ae(()=>{let S=Dl(s).getState();return S.phase==="DROP_ANIMATING"?!0:S.phase==="IDLE"?!1:S.isDragging},[]),C=Le(()=>({isDragging:E,tryAbort:v}),[E,v]);n(C);let k=ae(S=>Sw(Dl(s).getState(),S),[]),T=ae(()=>Vi(Dl(s).getState()),[]),w=Le(()=>({marshal:_,focus:y,contextId:e,canLift:k,isMovementAllowed:T,dragHandleUsageInstructionsId:u,registry:m}),[e,_,u,y,k,T,m]);return p$({contextId:e,store:x,registry:m,customSensors:o||null,enableDefaultSensors:t.enableDefaultSensors!==!1}),P(()=>v,[v]),et.createElement(nu.Provider,{value:w},et.createElement(m0,{context:xg,store:x},t.children))}function m$(){return et.useId()}function ru(t){let e=m$(),n=t.dragHandleUsageInstructions||Yd.dragHandleUsageInstructions;return et.createElement(Zh,null,o=>et.createElement(g$,{nonce:t.nonce,contextId:e,setCallbacks:o,dragHandleUsageInstructions:n,enableDefaultSensors:t.enableDefaultSensors,sensors:t.sensors,onBeforeCapture:t.onBeforeCapture,onBeforeDragStart:t.onBeforeDragStart,onDragStart:t.onDragStart,onDragUpdate:t.onDragUpdate,onDragEnd:t.onDragEnd,autoScrollerOptions:t.autoScrollerOptions},t.children))}var H0={dragging:5e3,dropAnimating:4500},_$=(t,e)=>e?Il.drop(e.duration):t?Il.snap:Il.fluid,b$=(t,e)=>{if(t)return e?Rl.opacity.drop:Rl.opacity.combining},y$=t=>t.forceShouldAnimate!=null?t.forceShouldAnimate:t.mode==="SNAP";function x$(t){let n=t.dimension.client,{offset:o,combineWith:r,dropping:i}=t,s=!!r,a=y$(t),l=!!i,c=l?tg.drop(o,s):tg.moveTo(o);return{position:"fixed",top:n.marginBox.top,left:n.marginBox.left,boxSizing:"border-box",width:n.borderBox.width,height:n.borderBox.height,transition:_$(a,i),transform:c,opacity:b$(s,l),zIndex:l?H0.dropAnimating:H0.dragging,pointerEvents:"none"}}function v$(t){return{transform:tg.moveTo(t.offset),transition:t.shouldAnimateDisplacement?void 0:"none"}}function C$(t){return t.type==="DRAGGING"?x$(t):v$(t)}function E$(t,e,n=Kt){let o=window.getComputedStyle(e),r=e.getBoundingClientRect(),i=zh(r,o),s=Sl(i,n),a={client:i,tagName:e.tagName.toLowerCase(),display:o.display},l={x:i.marginBox.width,y:i.marginBox.height};return{descriptor:t,placeholder:a,displaceBy:l,client:i,page:s}}function w$(t){let e=vg("draggable"),{descriptor:n,registry:o,getDraggableRef:r,canDragInteractiveElements:i,shouldRespectForcePress:s,isEnabled:a}=t,l=Le(()=>({canDragInteractiveElements:i,shouldRespectForcePress:s,isEnabled:a}),[i,a,s]),c=ae(f=>{let h=r();return h||j(),E$(n,h,f)},[n,r]),d=Le(()=>({uniqueId:e,descriptor:n,options:l,getDimension:c}),[n,c,l,e]),u=Y(d),p=Y(!0);jn(()=>(o.draggable.register(u.current),()=>o.draggable.unregister(u.current)),[o.draggable]),jn(()=>{if(p.current){p.current=!1;return}let f=u.current;u.current=d,o.draggable.update(d,f)},[d,o.draggable])}var wg=et.createContext(null);function $w(t){t&&Ul(t)||j()}function T$(t,e,n){jl(()=>{function o(i){return`Draggable[id: ${i}]: `}let r=t.draggableId;r||j(!1),typeof r!="string"&&j(!1),Number.isInteger(t.index)||j(!1),t.mapped.type!=="DRAGGING"&&($w(n()),t.isEnabled&&(Mw(e,r)||j(!1)))})}function S$(t){}function Xd(t){let e=It(t);return e||j(),e}function k$(t){t.preventDefault()}var N$=t=>{let e=Y(null),n=ae((C=null)=>{e.current=C},[]),o=ae(()=>e.current,[]),{contextId:r,dragHandleUsageInstructionsId:i,registry:s}=Xd(nu),{type:a,droppableId:l}=Xd(wg),c=Le(()=>({id:t.draggableId,index:t.index,type:a,droppableId:l}),[t.draggableId,t.index,a,l]),{children:d,draggableId:u,isEnabled:p,shouldRespectForcePress:f,canDragInteractiveElements:h,isClone:m,mapped:_,dropAnimationFinished:b}=t;if(T$(t,r,o),S$(m),!m){let C=Le(()=>({descriptor:c,registry:s,getDraggableRef:o,canDragInteractiveElements:h,shouldRespectForcePress:f,isEnabled:p}),[c,s,o,h,f,p]);w$(C)}let y=Le(()=>p?{tabIndex:0,role:"button","aria-describedby":i,"data-rfd-drag-handle-draggable-id":u,"data-rfd-drag-handle-context-id":r,draggable:!1,onDragStart:k$}:null,[r,i,u,p]),x=ae(C=>{_.type==="DRAGGING"&&_.dropping&&C.propertyName==="transform"&&vl(b)},[b,_]),v=Le(()=>{let C=C$(_),k=_.type==="DRAGGING"&&_.dropping?x:void 0;return{innerRef:n,draggableProps:{"data-rfd-draggable-context-id":r,"data-rfd-draggable-id":u,style:C,onTransitionEnd:k},dragHandleProps:y}},[r,y,u,_,x,n]),E=Le(()=>({draggableId:c.id,type:c.type,source:{index:c.index,droppableId:c.droppableId}}),[c.droppableId,c.id,c.index,c.type]);return et.createElement(et.Fragment,null,d(v,_.snapshot,E))},zw=(t,e)=>t===e,Hw=t=>{let{combine:e,destination:n}=t;return n?n.droppableId:e?e.droppableId:null},D$=t=>t.combine?t.combine.draggableId:null,O$=t=>t.at&&t.at.type==="COMBINE"?t.at.combine.draggableId:null;function I$(){let t=Ht((r,i)=>({x:r,y:i})),e=Ht((r,i,s=null,a=null,l=null)=>({isDragging:!0,isClone:i,isDropAnimating:!!l,dropAnimation:l,mode:r,draggingOver:s,combineWith:a,combineTargetFor:null})),n=Ht((r,i,s,a,l=null,c=null,d=null)=>({mapped:{type:"DRAGGING",dropping:null,draggingOver:l,combineWith:c,mode:i,offset:r,dimension:s,forceShouldAnimate:d,snapshot:e(i,a,l,c,null)}}));return(r,i)=>{if(Bl(r)){if(r.critical.draggable.id!==i.draggableId)return null;let s=r.current.client.offset,a=r.dimensions.draggables[i.draggableId],l=Un(r.impact),c=O$(r.impact),d=r.forceShouldAnimate;return n(t(s.x,s.y),r.movementMode,a,i.isClone,l,c,d)}if(r.phase==="DROP_ANIMATING"){let s=r.completed;if(s.result.draggableId!==i.draggableId)return null;let a=i.isClone,l=r.dimensions.draggables[i.draggableId],c=s.result,d=c.mode,u=Hw(c),p=D$(c),h={duration:r.dropDuration,curve:gg.drop,moveTo:r.newHomeClientOffset,opacity:p?Rl.opacity.drop:null,scale:p?Rl.scale.drop:null};return{mapped:{type:"DRAGGING",offset:r.newHomeClientOffset,dimension:l,dropping:h,draggingOver:u,combineWith:p,mode:d,forceShouldAnimate:null,snapshot:e(d,a,u,p,h)}}}return null}}function Kw(t=null){return{isDragging:!1,isDropAnimating:!1,isClone:!1,dropAnimation:null,mode:null,draggingOver:null,combineTargetFor:t,combineWith:null}}var M$={mapped:{type:"SECONDARY",offset:Kt,combineTargetFor:null,shouldAnimateDisplacement:!0,snapshot:Kw(null)}};function A$(){let t=Ht((s,a)=>({x:s,y:a})),e=Ht(Kw),n=Ht((s,a=null,l)=>({mapped:{type:"SECONDARY",offset:s,combineTargetFor:a,shouldAnimateDisplacement:l,snapshot:e(a)}})),o=s=>s?n(Kt,s,!0):null,r=(s,a,l,c)=>{let d=l.displaced.visible[s],u=!!(c.inVirtualList&&c.effected[s]),p=Qd(l),f=p&&p.draggableId===s?a:null;if(!d){if(!u)return o(f);if(l.displaced.invisible[s])return null;let _=oa(c.displacedBy.point),b=t(_.x,_.y);return n(b,f,!0)}if(u)return o(f);let h=l.displacedBy.point,m=t(h.x,h.y);return n(m,f,d.shouldAnimate)};return(s,a)=>{if(Bl(s))return s.critical.draggable.id===a.draggableId?null:r(a.draggableId,s.critical.draggable.id,s.impact,s.afterCritical);if(s.phase==="DROP_ANIMATING"){let l=s.completed;return l.result.draggableId===a.draggableId?null:r(a.draggableId,l.result.draggableId,l.impact,l.afterCritical)}return null}}var L$=()=>{let t=I$(),e=A$();return(o,r)=>t(o,r)||e(o,r)||M$},R$={dropAnimationFinished:yw},P$=Fh(L$,R$,null,{context:xg,areStatePropsEqual:zw})(N$);function Uw(t){return Xd(wg).isUsingCloneFor===t.draggableId&&!t.isClone?null:et.createElement(P$,t)}function iu(t){let e=typeof t.isDragDisabled=="boolean"?!t.isDragDisabled:!0,n=!!t.disableInteractiveElementBlocking,o=!!t.shouldRespectForcePress;return et.createElement(Uw,nh({},t,{isClone:!1,isEnabled:e,canDragInteractiveElements:n,shouldRespectForcePress:o}))}var Tg=t=>e=>t===e,F$=Tg("scroll"),B$=Tg("auto"),$$=Tg("visible"),K0=(t,e)=>e(t.overflowX)||e(t.overflowY),z$=(t,e)=>e(t.overflowX)&&e(t.overflowY),jw=t=>{let e=window.getComputedStyle(t),n={overflowX:e.overflowX,overflowY:e.overflowY};return K0(n,F$)||K0(n,B$)},H$=()=>!1,Vw=t=>t==null?null:t===document.body?H$()?t:null:t===document.documentElement?null:jw(t)?t:Vw(t.parentElement);var rg=t=>({x:t.scrollLeft,y:t.scrollTop}),Ww=t=>t?window.getComputedStyle(t).position==="fixed"?!0:Ww(t.parentElement):!1,K$=t=>{let e=Vw(t),n=Ww(t);return{closestScrollable:e,isFixedOnPage:n}},U$=({descriptor:t,isEnabled:e,isCombineEnabled:n,isFixedOnPage:o,direction:r,client:i,page:s,closest:a})=>{let l=(()=>{if(!a)return null;let{scrollSize:p,client:f}=a,h=Ew({scrollHeight:p.scrollHeight,scrollWidth:p.scrollWidth,height:f.paddingBox.height,width:f.paddingBox.width});return{pageMarginBox:a.page.marginBox,frameClient:f,scrollSize:p,shouldClipSubject:a.shouldClipSubject,scroll:{initial:a.scroll,current:a.scroll,max:h,diff:{value:Kt,displacement:Kt}}}})(),c=r==="vertical"?lg:nw,d=ea({page:s,withPlaceholder:null,axis:c,frame:l});return{descriptor:t,isCombineEnabled:n,isFixedOnPage:o,axis:c,isEnabled:e,client:i,page:s,frame:l,subject:d}},j$=(t,e)=>{let n=Hh(t);if(!e||t!==e)return n;let o=n.paddingBox.top-e.scrollTop,r=n.paddingBox.left-e.scrollLeft,i=o+e.scrollHeight,s=r+e.scrollWidth,l=Ud({top:o,right:s,bottom:i,left:r},n.border);return jd({borderBox:l,margin:n.margin,border:n.border,padding:n.padding})},V$=({ref:t,descriptor:e,env:n,windowScroll:o,direction:r,isDropDisabled:i,isCombineEnabled:s,shouldClipSubject:a})=>{let l=n.closestScrollable,c=j$(t,l),d=Sl(c,o),u=(()=>{if(!l)return null;let f=Hh(l),h={scrollHeight:l.scrollHeight,scrollWidth:l.scrollWidth};return{client:f,page:Sl(f,o),scroll:rg(l),scrollSize:h,shouldClipSubject:a}})();return U$({descriptor:e,isEnabled:!i,isCombineEnabled:s,isFixedOnPage:n.isFixedOnPage,direction:r,client:c,page:d,closest:u})},W$={passive:!1},G$={passive:!0},U0=t=>t.shouldPublishImmediately?W$:G$,Gd=t=>t&&t.env.closestScrollable||null;function Y$(t){let e=Y(null),n=Xd(nu),o=vg("droppable"),{registry:r,marshal:i}=n,s=Cg(t),a=Le(()=>({id:t.droppableId,type:t.type,mode:t.mode}),[t.droppableId,t.mode,t.type]),l=Y(a),c=Le(()=>Ht((v,E)=>{e.current||j();let C={x:v,y:E};i.updateDroppableScroll(a.id,C)}),[a.id,i]),d=ae(()=>{let v=e.current;return!v||!v.env.closestScrollable?Kt:rg(v.env.closestScrollable)},[]),u=ae(()=>{let v=d();c(v.x,v.y)},[d,c]),p=Le(()=>Qs(u),[u]),f=ae(()=>{let v=e.current,E=Gd(v);if(v&&E||j(),v.scrollOptions.shouldPublishImmediately){u();return}p()},[p,u]),h=ae((v,E)=>{e.current&&j();let C=s.current,k=C.getDroppableRef();k||j();let T=K$(k),w={ref:k,descriptor:a,env:T,scrollOptions:E};e.current=w;let S=V$({ref:k,descriptor:a,env:T,windowScroll:v,direction:C.direction,isDropDisabled:C.isDropDisabled,isCombineEnabled:C.isCombineEnabled,shouldClipSubject:!C.ignoreContainerClipping}),N=T.closestScrollable;return N&&(N.setAttribute(P0.contextId,n.contextId),N.addEventListener("scroll",f,U0(w.scrollOptions))),S},[n.contextId,a,f,s]),m=ae(()=>{let v=e.current,E=Gd(v);return v&&E||j(),rg(E)},[]),_=ae(()=>{let v=e.current;v||j();let E=Gd(v);e.current=null,E&&(p.cancel(),E.removeAttribute(P0.contextId),E.removeEventListener("scroll",f,U0(v.scrollOptions)))},[f,p]),b=ae(v=>{let E=e.current;E||j();let C=Gd(E);C||j(),C.scrollTop+=v.y,C.scrollLeft+=v.x},[]),y=Le(()=>({getDimensionAndWatchScroll:h,getScrollWhileDragging:m,dragStopped:_,scroll:b}),[_,h,m,b]),x=Le(()=>({uniqueId:o,descriptor:a,callbacks:y}),[y,a,o]);jn(()=>(l.current=x.descriptor,r.droppable.register(x),()=>{e.current&&_(),r.droppable.unregister(x)}),[y,a,_,x,i,r.droppable]),jn(()=>{e.current&&i.updateDroppableIsEnabled(l.current.id,!t.isDropDisabled)},[t.isDropDisabled,i]),jn(()=>{e.current&&i.updateDroppableIsCombineEnabled(l.current.id,t.isCombineEnabled)},[t.isCombineEnabled,i])}function Yh(){}var j0={width:0,height:0,margin:YP},q$=({isAnimatingOpenOnMount:t,placeholder:e,animate:n})=>t||n==="close"?j0:{height:e.client.borderBox.height,width:e.client.borderBox.width,margin:e.client.margin},J$=({isAnimatingOpenOnMount:t,placeholder:e,animate:n})=>{let o=q$({isAnimatingOpenOnMount:t,placeholder:e,animate:n});return{display:e.display,boxSizing:"border-box",width:o.width,height:o.height,marginTop:o.margin.top,marginRight:o.margin.right,marginBottom:o.margin.bottom,marginLeft:o.margin.left,flexShrink:"0",flexGrow:"0",pointerEvents:"none",transition:n!=="none"?Il.placeholder:null}},X$=t=>{let e=Y(null),n=ae(()=>{e.current&&(clearTimeout(e.current),e.current=null)},[]),{animate:o,onTransitionEnd:r,onClose:i,contextId:s}=t,[a,l]=R(t.animate==="open");P(()=>a?o!=="open"?(n(),l(!1),Yh):e.current?Yh:(e.current=setTimeout(()=>{e.current=null,l(!1)}),n):Yh,[o,a,n]);let c=ae(u=>{u.propertyName==="height"&&(r(),o==="close"&&i())},[o,i,r]),d=J$({isAnimatingOpenOnMount:a,animate:t.animate,placeholder:t.placeholder});return et.createElement(t.placeholder.tagName,{style:d,"data-rfd-placeholder-context-id":s,onTransitionEnd:c,ref:t.innerRef})},Z$=et.memo(X$);function qh(t){return typeof t=="boolean"}function Jh(t,e){e.forEach(n=>n(t))}var Q$=[function({props:e}){e.droppableId||j(),typeof e.droppableId!="string"&&j()},function({props:e}){qh(e.isDropDisabled)||j(),qh(e.isCombineEnabled)||j(),qh(e.ignoreContainerClipping)||j()},function({getDroppableRef:e}){$w(e())}],ez=[function({props:e,getPlaceholderRef:n}){!e.placeholder||n()}],tz=[function({props:e}){e.renderClone||j()},function({getPlaceholderRef:e}){e()&&j()}];function nz(t){jl(()=>{Jh(t,Q$),t.props.mode==="standard"&&Jh(t,ez),t.props.mode==="virtual"&&Jh(t,tz)})}var ig=class extends et.PureComponent{constructor(...e){super(...e),this.state={isVisible:!!this.props.on,data:this.props.on,animate:this.props.shouldAnimate&&this.props.on?"open":"none"},this.onClose=()=>{this.state.animate==="close"&&this.setState({isVisible:!1})}}static getDerivedStateFromProps(e,n){return e.shouldAnimate?e.on?{isVisible:!0,data:e.on,animate:"open"}:n.isVisible?{isVisible:!0,data:n.data,animate:"close"}:{isVisible:!1,animate:"close",data:null}:{isVisible:!!e.on,data:e.on,animate:"none"}}render(){if(!this.state.isVisible)return null;let e={onClose:this.onClose,data:this.state.data,animate:this.state.animate};return this.props.children(e)}},oz=t=>{let e=It(nu);e||j();let{contextId:n,isMovementAllowed:o}=e,r=Y(null),i=Y(null),{children:s,droppableId:a,type:l,mode:c,direction:d,ignoreContainerClipping:u,isDropDisabled:p,isCombineEnabled:f,snapshot:h,useClone:m,updateViewportMaxScroll:_,getContainerForClone:b}=t,y=ae(()=>r.current,[]),x=ae((D=null)=>{r.current=D},[]),v=ae(()=>i.current,[]),E=ae((D=null)=>{i.current=D},[]);nz({props:t,getDroppableRef:y,getPlaceholderRef:v});let C=ae(()=>{o()&&_({maxScroll:Tw()})},[o,_]);Y$({droppableId:a,type:l,mode:c,direction:d,isDropDisabled:p,isCombineEnabled:f,ignoreContainerClipping:u,getDroppableRef:y});let k=Le(()=>et.createElement(ig,{on:t.placeholder,shouldAnimate:t.shouldAnimatePlaceholder},({onClose:D,data:O,animate:M})=>et.createElement(Z$,{placeholder:O,onClose:D,innerRef:E,animate:M,contextId:n,onTransitionEnd:C})),[n,C,t.placeholder,t.shouldAnimatePlaceholder,E]),T=Le(()=>({innerRef:x,placeholder:k,droppableProps:{"data-rfd-droppable-id":a,"data-rfd-droppable-context-id":n}}),[n,a,k,x]),w=m?m.dragging.draggableId:null,S=Le(()=>({droppableId:a,type:l,isUsingCloneFor:w}),[a,w,l]);function N(){if(!m)return null;let{dragging:D,render:O}=m,M=et.createElement(Uw,{draggableId:D.draggableId,index:D.source.index,isClone:!0,isEnabled:!0,shouldRespectForcePress:!1,canDragInteractiveElements:!0},(I,L)=>O(I,L,D));return et.createPortal(M,b())}return et.createElement(wg.Provider,{value:S},s(T,h),N())};function rz(){return document.body||j(),document.body}var V0={mode:"standard",type:"DEFAULT",direction:"vertical",isDropDisabled:!1,isCombineEnabled:!1,ignoreContainerClipping:!1,renderClone:null,getContainerForClone:rz},Gw=t=>{let e={...t},n;for(n in V0)t[n]===void 0&&(e={...e,[n]:V0[n]});return e},Xh=(t,e)=>t===e.droppable.type,W0=(t,e)=>e.draggables[t.draggable.id],iz=()=>{let t={placeholder:null,shouldAnimatePlaceholder:!0,snapshot:{isDraggingOver:!1,draggingOverWith:null,draggingFromThisWith:null,isUsingPlaceholder:!1},useClone:null},e={...t,shouldAnimatePlaceholder:!1},n=Ht(i=>({draggableId:i.id,type:i.type,source:{index:i.index,droppableId:i.droppableId}})),o=Ht((i,s,a,l,c,d)=>{let u=c.descriptor.id;if(c.descriptor.droppableId===i){let h=d?{render:d,dragging:n(c.descriptor)}:null,m={isDraggingOver:a,draggingOverWith:a?u:null,draggingFromThisWith:u,isUsingPlaceholder:!0};return{placeholder:c.placeholder,shouldAnimatePlaceholder:!1,snapshot:m,useClone:h}}if(!s)return e;if(!l)return t;let f={isDraggingOver:a,draggingOverWith:u,draggingFromThisWith:null,isUsingPlaceholder:!0};return{placeholder:c.placeholder,shouldAnimatePlaceholder:!0,snapshot:f,useClone:null}});return(i,s)=>{let a=Gw(s),l=a.droppableId,c=a.type,d=!a.isDropDisabled,u=a.renderClone;if(Bl(i)){let p=i.critical;if(!Xh(c,p))return e;let f=W0(p,i.dimensions),h=Un(i.impact)===l;return o(l,d,h,h,f,u)}if(i.phase==="DROP_ANIMATING"){let p=i.completed;if(!Xh(c,p.critical))return e;let f=W0(p.critical,i.dimensions);return o(l,d,Hw(p.result)===l,Un(p.impact)===l,f,u)}if(i.phase==="IDLE"&&i.completed&&!i.shouldFlush){let p=i.completed;if(!Xh(c,p.critical))return e;let f=Un(p.impact)===l,h=!!(p.impact.at&&p.impact.at.type==="COMBINE"),m=p.critical.droppable.id===l;return f?h?t:e:m?t:e}return e}},sz={updateViewportMaxScroll:sB},su=Fh(iz,sz,(t,e,n)=>({...Gw(n),...t,...e}),{context:xg,areStatePropsEqual:zw})(oz);zs();ke();zs();ke();function az(){return new URLSearchParams(window.location.search).get("deeplink")||""}var Yw=Ot(null);function qw(t){let e=az(),[n,o]=R(e),r={value:n,setValue:o};return P(()=>{o(e)},[e]),P(()=>{let i=s=>{let a=s.data;if(a.scrollToDeeplink){let l=a.scrollToDeeplink.deepKey,c=document.getElementById(l);if(c){o(l),Sg(c,{behavior:"smooth",force:!0});let d=new URL(window.location.href);d.searchParams.set("deeplink",l),window.history.replaceState({},"",d.toString())}}};return window.addEventListener("message",i),()=>{window.removeEventListener("message",i)}},[]),g(Yw.Provider,{value:r,children:t.children})}function Vl(){let t=It(Yw);if(!t)throw new Error("[useDeeplink()] DeeplinkContext not found, be sure to add <DeeplinkProvider>");return t}function lz(t){let e=t;for(;e&&e!==document.body;){let n=e.closest("details");if(n&&n.parentElement)n.open=!0,e=n.parentElement;else break}}function cz(t){let e=[],n=t;for(;n&&n!==document.body;){let o=n.closest(".DocEditor__ArrayField__item");if(!o)break;let r=o.querySelector(".DocEditor__ArrayField__item__header");if(r&&!e.includes(r))e.push(r),n=o.parentElement;else break}return e}function Sg(t,e={behavior:"auto"}){setTimeout(()=>{let n=document.querySelector(".DocumentPage__side");if(!n||n.scrollTop>0&&!e.force)return;lz(t);let r=cz(t).reduce((s,a)=>s+a.offsetHeight,0),i=t.offsetTop-r;n.scroll({top:i,behavior:e.behavior})},e.force?0:300)}function Jw(t){let e=new URL(window.location.href);return e.searchParams.set("deeplink",t),e.toString()}var dz={get:async()=>{try{let t=await uz();return t?JSON.parse(t):null}catch{return null}},set:t=>{navigator.clipboard&&navigator.clipboard.writeText&&navigator.clipboard.writeText(JSON.stringify(t,void 0,2)).catch(console.error)}};function kg(){return dz}async function uz(){try{if(navigator.clipboard&&navigator.clipboard.readText)return await navigator.clipboard.readText()}catch{}return null}function Vn(t,e){if(!fz())return;let n=pz();n&&n.contentWindow?.postMessage({highlightNode:{deepKey:t,options:e}},"*")}function pz(){return document.querySelector('iframe[title="iframe preview"]')}function fz(){let t=window.__ROOT_CTX.preview||{};return[!0,"to-preview"].includes(t.channel)}function Xw(t,e){return t.replace(/\{(.+?)\}/g,(n,o)=>{let r=e(o);return r??n})}var au=class extends Error{};function Zw(t,e,n){let o=t.preview?.title;if(o)return sa(o,e,n)}function Qw(t,e,n){let o=t.preview?.image;if(o)return sa(o,e,n)}function sa(t,e,n){if(!t)return;let o=Array.isArray(t)?t:[t],r=n?.index,i=s=>{if(r!==void 0){if(s==="_index"||s==="_index0")return String(r);if(s==="_index1")return String(r+1);if(s==="_index:02")return String(r).padStart(2,"0");if(s==="_index:03")return String(r).padStart(3,"0")}let a=Po(e,s);if(!a)throw new au(s);if(pd(a)){let l=hz(a);if(l)return l}return String(a)};for(let s of o)try{return Xw(s,i)}catch(a){if(a instanceof au)continue;throw a}}function hz(t){let e=t?.blocks||[];for(let n of e)if(n.type==="paragraph"){let o=n.data?.text||"";o=o.replace(/<br\s*\/?>/gi,`
|
|
82
|
-
`),o=o.replace(/<[^>]+>/g,"").replace(/ /g," ");let r=o.split(/\r?\n/)[0].trim();if(r)return r}}function Yi(t,e,n={}){if(e==null)return!0;switch(t.type){case"string":case"select":case"date":case"datetime":return e==="";case"multiselect":return!Array.isArray(e)||e.length===0;case"number":case"boolean":return e==null;case"image":case"file":return!e||!e.src;case"reference":return!e||!e.id;case"references":return!Array.isArray(e)||e.length===0;case"richtext":return!pd(e);case"object":if(!Ws(e)||Object.keys(e).length===0)return!0;for(let o of t.fields||[])if(o.id&&!Yi(o,e[o.id],n))return!1;return!0;case"array":if(Array.isArray(e)){if(e.length===0)return!0;for(let o of e)if(!Yi(t.of,o,n))return!1;return!0}if(!Ws(e)||!Array.isArray(e._array)||e._array.length===0)return!0;for(let o of e._array)if(!Yi(t.of,e[o],n))return!1;return!0;case"oneof":{if(!Ws(e)||!e._type)return!0;let o,r=t.types||[];if(typeof r[0]=="string"?r.includes(e._type)&&(o=n[e._type]):o=r.find(i=>i.name===e._type),!o)return!0;for(let i of o.fields||[])if(i.id&&!Yi(i,e[i.id],n))return!1;return!0}default:return!1}}ke();function eT(t,e){let n=!1;return(...o)=>{n||(t(...o),n=!0,setTimeout(()=>{n=!1},e))}}var Wl=class extends Zs{constructor(n){super();this.interval=0;this.timeout=0;this.interval=n}start(){this.timeout=window.setTimeout(()=>{this.tick()},this.interval)}tick(){this.dispatch("tick"),this.start()}reset(){this.stop(),this.start()}stop(){this.timeout&&(window.clearTimeout(this.timeout),this.timeout=0)}};var gz=60*sh.second,tT=5*sh.minute,Ng=class extends Zs{constructor(n){super();this.started=!1;this.timer=new Wl(gz);this.idleTimer=new Wl(tT);this.onUserInteraction=eT(()=>{this.idleTimer.reset()},5e3);this.id=n;let o=window.__ROOT_CTX.rootConfig.projectId,r=window.firebase.db;this.docRef=Xv(r,"Projects",o,"Viewers",n),this.timer.on("tick",()=>this.onTick()),this.idleTimer.on("tick",()=>this.onIdle()),window.addEventListener("mousemove",this.onUserInteraction),window.addEventListener("keypress",this.onUserInteraction)}async start(){this.started||(this.started=!0,this.dbUnsubscribe=tC(this.docRef,n=>{let o=n.data();this.onData(o)}),this.onTick(),this.timer.start())}onData(n){let o=window.firebase.user,r=dd.now(),i=Object.values(n).filter(s=>!(s.email===o.email||r.toMillis()-s.lastViewedAt.toMillis()>tT));this.dispatch("change",i)}async onTick(){let n=window.firebase.user;if(!n.email){console.log("no user email:",n);return}await Qv(this.docRef,{[n.email]:{email:n.email,photoURL:n.photoURL,lastViewedAt:rh()}},{merge:!0})}async onIdle(){this.stop()}stop(){this.started&&(this.dbUnsubscribe&&this.dbUnsubscribe(),this.timer.stop(),this.idleTimer.stop(),this.onDisconnect(),this.started=!1)}async onDisconnect(){let n=window.firebase.user;if(!n.email){console.log("no user email:",n);return}let o=new Zv(n.email,"disconnectedAt");await eC(this.docRef,o,rh())}async dispose(){super.dispose(),this.stop(),this.timer.dispose(),this.idleTimer.dispose()}};function nT(t){let e=oC(t.id),[n,o]=R([]);if(P(()=>{let l=new Ng(e);l.on("change",d=>o(d)),l.start();let c=()=>{document.hidden||document.visibilityState!=="visible"?l.stop():l.started||l.start()};return document.addEventListener("visibilitychange",c),()=>{l.dispose(),document.removeEventListener("visibilitychange",c)}},[e]),n.length===0)return null;function r(l){return l.disconnectedAt?l.disconnectedAt>l.lastViewedAt:!1}let i=t.max||3,s=n.slice(0,i),a=n.length-i;return g("div",{className:"Viewers",children:[s.map(l=>g(OE,{email:l.email,size:30,inactive:r(l),className:"Viewers__avatar"},l.email)),a>0&&g(Vv,{className:"Viewers__avatar",size:30,radius:"xl",children:["+",a]})]})}function oT(t){let n=t.field.checkboxLabel||"Enabled",[o,r]=en(t.deepKey,!1);return g("div",{className:"DocEditor__BooleanField",children:g(Ao,{label:n,onChange:i=>{let s=i.currentTarget;r(s.checked)},checked:o,size:"xs"})})}ke();function rT(t){let[e,n]=en(t.deepKey),[o,r]=R(null),i=(s,a)=>{if(a&&!a.valid){r("Invalid date");return}if(s){let l=new Date(s);if(isNaN(l.getTime())){r("Invalid date");return}r(null),n(s)}else r(null),n(null)};return g("div",{className:"DocEditor__DateField",children:[g("input",{type:"date",value:e||"",onChange:s=>{let a=s.currentTarget;i(a.value,a.validity)}}),o&&g("div",{style:{color:"red",fontSize:"12px",marginTop:"4px"},children:o})]})}var mz={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},iT=(t,e,n)=>{let o,r=mz[t];return typeof r=="string"?o=r:e===1?o=r.one:o=r.other.replace("{{count}}",e.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+o:o+" ago":o};function lu(t){return(e={})=>{let n=e.width?String(e.width):t.defaultWidth;return t.formats[n]||t.formats[t.defaultWidth]}}var _z={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},bz={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},yz={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},sT={date:lu({formats:_z,defaultWidth:"full"}),time:lu({formats:bz,defaultWidth:"full"}),dateTime:lu({formats:yz,defaultWidth:"full"})};var xz={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},aT=(t,e,n,o)=>xz[t];function aa(t){return(e,n)=>{let o=n?.context?String(n.context):"standalone",r;if(o==="formatting"&&t.formattingValues){let s=t.defaultFormattingWidth||t.defaultWidth,a=n?.width?String(n.width):s;r=t.formattingValues[a]||t.formattingValues[s]}else{let s=t.defaultWidth,a=n?.width?String(n.width):t.defaultWidth;r=t.values[a]||t.values[s]}let i=t.argumentCallback?t.argumentCallback(e):e;return r[i]}}var vz={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Cz={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Ez={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},wz={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},Tz={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},Sz={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},kz=(t,e)=>{let n=Number(t),o=n%100;if(o>20||o<10)switch(o%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},lT={ordinalNumber:kz,era:aa({values:vz,defaultWidth:"wide"}),quarter:aa({values:Cz,defaultWidth:"wide",argumentCallback:t=>t-1}),month:aa({values:Ez,defaultWidth:"wide"}),day:aa({values:wz,defaultWidth:"wide"}),dayPeriod:aa({values:Tz,defaultWidth:"wide",formattingValues:Sz,defaultFormattingWidth:"wide"})};function la(t){return(e,n={})=>{let o=n.width,r=o&&t.matchPatterns[o]||t.matchPatterns[t.defaultMatchWidth],i=e.match(r);if(!i)return null;let s=i[0],a=o&&t.parsePatterns[o]||t.parsePatterns[t.defaultParseWidth],l=Array.isArray(a)?Dz(a,u=>u.test(s)):Nz(a,u=>u.test(s)),c;c=t.valueCallback?t.valueCallback(l):l,c=n.valueCallback?n.valueCallback(c):c;let d=e.slice(s.length);return{value:c,rest:d}}}function Nz(t,e){for(let n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e(t[n]))return n}function Dz(t,e){for(let n=0;n<t.length;n++)if(e(t[n]))return n}function cT(t){return(e,n={})=>{let o=e.match(t.matchPattern);if(!o)return null;let r=o[0],i=e.match(t.parsePattern);if(!i)return null;let s=t.valueCallback?t.valueCallback(i[0]):i[0];s=n.valueCallback?n.valueCallback(s):s;let a=e.slice(r.length);return{value:s,rest:a}}}var Oz=/^(\d+)(th|st|nd|rd)?/i,Iz=/\d+/i,Mz={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},Az={any:[/^b/i,/^(a|c)/i]},Lz={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Rz={any:[/1/i,/2/i,/3/i,/4/i]},Pz={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},Fz={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},Bz={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},$z={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},zz={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},Hz={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},dT={ordinalNumber:cT({matchPattern:Oz,parsePattern:Iz,valueCallback:t=>parseInt(t,10)}),era:la({matchPatterns:Mz,defaultMatchWidth:"wide",parsePatterns:Az,defaultParseWidth:"any"}),quarter:la({matchPatterns:Lz,defaultMatchWidth:"wide",parsePatterns:Rz,defaultParseWidth:"any",valueCallback:t=>t+1}),month:la({matchPatterns:Pz,defaultMatchWidth:"wide",parsePatterns:Fz,defaultParseWidth:"any"}),day:la({matchPatterns:Bz,defaultMatchWidth:"wide",parsePatterns:$z,defaultParseWidth:"any"}),dayPeriod:la({matchPatterns:zz,defaultMatchWidth:"any",parsePatterns:Hz,defaultParseWidth:"any"})};var Dg={code:"en-US",formatDistance:iT,formatLong:sT,formatRelative:aT,localize:lT,match:dT,options:{weekStartsOn:0,firstWeekContainsDate:1}};var Kz={};function $o(){return Kz}var Uz=Math.pow(10,8)*24*60*60*1e3,eq=-Uz,cu=6048e5,uT=864e5;var jz=3600;var pT=jz*24,tq=pT*7,Vz=pT*365.2425,Wz=Vz/12,nq=Wz*3,Og=Symbol.for("constructDateFrom");function kn(t,e){return typeof t=="function"?t(e):t&&typeof t=="object"&&Og in t?t[Og](e):t instanceof Date?new t.constructor(e):new Date(e)}function ft(t,e){return kn(e||t,t)}function Ig(t){let e=ft(t),n=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return n.setUTCFullYear(e.getFullYear()),+t-+n}function fT(t,...e){let n=kn.bind(null,t||e.find(o=>typeof o=="object"));return e.map(n)}function Mg(t,e){let n=ft(t,e?.in);return n.setHours(0,0,0,0),n}function hT(t,e,n){let[o,r]=fT(n?.in,t,e),i=Mg(o),s=Mg(r),a=+i-Ig(i),l=+s-Ig(s);return Math.round((a-l)/uT)}function gT(t,e){let n=ft(t,e?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function mT(t,e){let n=ft(t,e?.in);return hT(n,gT(n))+1}function fr(t,e){let n=$o(),o=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,r=ft(t,e?.in),i=r.getDay(),s=(i<o?7:0)+i-o;return r.setDate(r.getDate()-s),r.setHours(0,0,0,0),r}function qi(t,e){return fr(t,{...e,weekStartsOn:1})}function du(t,e){let n=ft(t,e?.in),o=n.getFullYear(),r=kn(n,0);r.setFullYear(o+1,0,4),r.setHours(0,0,0,0);let i=qi(r),s=kn(n,0);s.setFullYear(o,0,4),s.setHours(0,0,0,0);let a=qi(s);return n.getTime()>=i.getTime()?o+1:n.getTime()>=a.getTime()?o:o-1}function _T(t,e){let n=du(t,e),o=kn(e?.in||t,0);return o.setFullYear(n,0,4),o.setHours(0,0,0,0),qi(o)}function bT(t,e){let n=ft(t,e?.in),o=+qi(n)-+_T(n);return Math.round(o/cu)+1}function uu(t,e){let n=ft(t,e?.in),o=n.getFullYear(),r=$o(),i=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,s=kn(e?.in||t,0);s.setFullYear(o+1,0,i),s.setHours(0,0,0,0);let a=fr(s,e),l=kn(e?.in||t,0);l.setFullYear(o,0,i),l.setHours(0,0,0,0);let c=fr(l,e);return+n>=+a?o+1:+n>=+c?o:o-1}function yT(t,e){let n=$o(),o=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,r=uu(t,e),i=kn(e?.in||t,0);return i.setFullYear(r,0,o),i.setHours(0,0,0,0),fr(i,e)}function xT(t,e){let n=ft(t,e?.in),o=+fr(n,e)-+yT(n,e);return Math.round(o/cu)+1}function $e(t,e){let n=t<0?"-":"",o=Math.abs(t).toString().padStart(e,"0");return n+o}var hr={y(t,e){let n=t.getFullYear(),o=n>0?n:1-n;return $e(e==="yy"?o%100:o,e.length)},M(t,e){let n=t.getMonth();return e==="M"?String(n+1):$e(n+1,2)},d(t,e){return $e(t.getDate(),e.length)},a(t,e){let n=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];default:return n==="am"?"a.m.":"p.m."}},h(t,e){return $e(t.getHours()%12||12,e.length)},H(t,e){return $e(t.getHours(),e.length)},m(t,e){return $e(t.getMinutes(),e.length)},s(t,e){return $e(t.getSeconds(),e.length)},S(t,e){let n=e.length,o=t.getMilliseconds(),r=Math.trunc(o*Math.pow(10,n-3));return $e(r,e.length)}};var ca={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Ag={G:function(t,e,n){let o=t.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return n.era(o,{width:"abbreviated"});case"GGGGG":return n.era(o,{width:"narrow"});default:return n.era(o,{width:"wide"})}},y:function(t,e,n){if(e==="yo"){let o=t.getFullYear(),r=o>0?o:1-o;return n.ordinalNumber(r,{unit:"year"})}return hr.y(t,e)},Y:function(t,e,n,o){let r=uu(t,o),i=r>0?r:1-r;if(e==="YY"){let s=i%100;return $e(s,2)}return e==="Yo"?n.ordinalNumber(i,{unit:"year"}):$e(i,e.length)},R:function(t,e){let n=du(t);return $e(n,e.length)},u:function(t,e){let n=t.getFullYear();return $e(n,e.length)},Q:function(t,e,n){let o=Math.ceil((t.getMonth()+1)/3);switch(e){case"Q":return String(o);case"QQ":return $e(o,2);case"Qo":return n.ordinalNumber(o,{unit:"quarter"});case"QQQ":return n.quarter(o,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(o,{width:"narrow",context:"formatting"});default:return n.quarter(o,{width:"wide",context:"formatting"})}},q:function(t,e,n){let o=Math.ceil((t.getMonth()+1)/3);switch(e){case"q":return String(o);case"qq":return $e(o,2);case"qo":return n.ordinalNumber(o,{unit:"quarter"});case"qqq":return n.quarter(o,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(o,{width:"narrow",context:"standalone"});default:return n.quarter(o,{width:"wide",context:"standalone"})}},M:function(t,e,n){let o=t.getMonth();switch(e){case"M":case"MM":return hr.M(t,e);case"Mo":return n.ordinalNumber(o+1,{unit:"month"});case"MMM":return n.month(o,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(o,{width:"narrow",context:"formatting"});default:return n.month(o,{width:"wide",context:"formatting"})}},L:function(t,e,n){let o=t.getMonth();switch(e){case"L":return String(o+1);case"LL":return $e(o+1,2);case"Lo":return n.ordinalNumber(o+1,{unit:"month"});case"LLL":return n.month(o,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(o,{width:"narrow",context:"standalone"});default:return n.month(o,{width:"wide",context:"standalone"})}},w:function(t,e,n,o){let r=xT(t,o);return e==="wo"?n.ordinalNumber(r,{unit:"week"}):$e(r,e.length)},I:function(t,e,n){let o=bT(t);return e==="Io"?n.ordinalNumber(o,{unit:"week"}):$e(o,e.length)},d:function(t,e,n){return e==="do"?n.ordinalNumber(t.getDate(),{unit:"date"}):hr.d(t,e)},D:function(t,e,n){let o=mT(t);return e==="Do"?n.ordinalNumber(o,{unit:"dayOfYear"}):$e(o,e.length)},E:function(t,e,n){let o=t.getDay();switch(e){case"E":case"EE":case"EEE":return n.day(o,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(o,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(o,{width:"short",context:"formatting"});default:return n.day(o,{width:"wide",context:"formatting"})}},e:function(t,e,n,o){let r=t.getDay(),i=(r-o.weekStartsOn+8)%7||7;switch(e){case"e":return String(i);case"ee":return $e(i,2);case"eo":return n.ordinalNumber(i,{unit:"day"});case"eee":return n.day(r,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(r,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},c:function(t,e,n,o){let r=t.getDay(),i=(r-o.weekStartsOn+8)%7||7;switch(e){case"c":return String(i);case"cc":return $e(i,e.length);case"co":return n.ordinalNumber(i,{unit:"day"});case"ccc":return n.day(r,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(r,{width:"narrow",context:"standalone"});case"cccccc":return n.day(r,{width:"short",context:"standalone"});default:return n.day(r,{width:"wide",context:"standalone"})}},i:function(t,e,n){let o=t.getDay(),r=o===0?7:o;switch(e){case"i":return String(r);case"ii":return $e(r,e.length);case"io":return n.ordinalNumber(r,{unit:"day"});case"iii":return n.day(o,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(o,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(o,{width:"short",context:"formatting"});default:return n.day(o,{width:"wide",context:"formatting"})}},a:function(t,e,n){let r=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(r,{width:"narrow",context:"formatting"});default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},b:function(t,e,n){let o=t.getHours(),r;switch(o===12?r=ca.noon:o===0?r=ca.midnight:r=o/12>=1?"pm":"am",e){case"b":case"bb":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(r,{width:"narrow",context:"formatting"});default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},B:function(t,e,n){let o=t.getHours(),r;switch(o>=17?r=ca.evening:o>=12?r=ca.afternoon:o>=4?r=ca.morning:r=ca.night,e){case"B":case"BB":case"BBB":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(r,{width:"narrow",context:"formatting"});default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},h:function(t,e,n){if(e==="ho"){let o=t.getHours()%12;return o===0&&(o=12),n.ordinalNumber(o,{unit:"hour"})}return hr.h(t,e)},H:function(t,e,n){return e==="Ho"?n.ordinalNumber(t.getHours(),{unit:"hour"}):hr.H(t,e)},K:function(t,e,n){let o=t.getHours()%12;return e==="Ko"?n.ordinalNumber(o,{unit:"hour"}):$e(o,e.length)},k:function(t,e,n){let o=t.getHours();return o===0&&(o=24),e==="ko"?n.ordinalNumber(o,{unit:"hour"}):$e(o,e.length)},m:function(t,e,n){return e==="mo"?n.ordinalNumber(t.getMinutes(),{unit:"minute"}):hr.m(t,e)},s:function(t,e,n){return e==="so"?n.ordinalNumber(t.getSeconds(),{unit:"second"}):hr.s(t,e)},S:function(t,e){return hr.S(t,e)},X:function(t,e,n){let o=t.getTimezoneOffset();if(o===0)return"Z";switch(e){case"X":return CT(o);case"XXXX":case"XX":return Ji(o);default:return Ji(o,":")}},x:function(t,e,n){let o=t.getTimezoneOffset();switch(e){case"x":return CT(o);case"xxxx":case"xx":return Ji(o);default:return Ji(o,":")}},O:function(t,e,n){let o=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+vT(o,":");default:return"GMT"+Ji(o,":")}},z:function(t,e,n){let o=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+vT(o,":");default:return"GMT"+Ji(o,":")}},t:function(t,e,n){let o=Math.trunc(+t/1e3);return $e(o,e.length)},T:function(t,e,n){return $e(+t,e.length)}};function vT(t,e=""){let n=t>0?"-":"+",o=Math.abs(t),r=Math.trunc(o/60),i=o%60;return i===0?n+String(r):n+String(r)+e+$e(i,2)}function CT(t,e){return t%60===0?(t>0?"-":"+")+$e(Math.abs(t)/60,2):Ji(t,e)}function Ji(t,e=""){let n=t>0?"-":"+",o=Math.abs(t),r=$e(Math.trunc(o/60),2),i=$e(o%60,2);return n+r+e+i}var ET=(t,e)=>{switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});default:return e.date({width:"full"})}},wT=(t,e)=>{switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});default:return e.time({width:"full"})}},Gz=(t,e)=>{let n=t.match(/(P+)(p+)?/)||[],o=n[1],r=n[2];if(!r)return ET(t,e);let i;switch(o){case"P":i=e.dateTime({width:"short"});break;case"PP":i=e.dateTime({width:"medium"});break;case"PPP":i=e.dateTime({width:"long"});break;default:i=e.dateTime({width:"full"});break}return i.replace("{{date}}",ET(o,e)).replace("{{time}}",wT(r,e))},TT={p:wT,P:Gz};var Yz=/^D+$/,qz=/^Y+$/,Jz=["D","DD","YY","YYYY"];function ST(t){return Yz.test(t)}function kT(t){return qz.test(t)}function NT(t,e,n){let o=Xz(t,e,n);if(console.warn(o),Jz.includes(t))throw new RangeError(o)}function Xz(t,e,n){let o=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${e}\`) for formatting ${o} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}function DT(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function OT(t){return!(!DT(t)&&typeof t!="number"||isNaN(+ft(t)))}var Zz=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Qz=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,eH=/^'([^]*?)'?$/,tH=/''/g,nH=/[a-zA-Z]/;function IT(t,e,n){let o=$o(),r=n?.locale??o.locale??Dg,i=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??o.firstWeekContainsDate??o.locale?.options?.firstWeekContainsDate??1,s=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??o.weekStartsOn??o.locale?.options?.weekStartsOn??0,a=ft(t,n?.in);if(!OT(a))throw new RangeError("Invalid time value");let l=e.match(Qz).map(d=>{let u=d[0];if(u==="p"||u==="P"){let p=TT[u];return p(d,r.formatLong)}return d}).join("").match(Zz).map(d=>{if(d==="''")return{isToken:!1,value:"'"};let u=d[0];if(u==="'")return{isToken:!1,value:oH(d)};if(Ag[u])return{isToken:!0,value:d};if(u.match(nH))throw new RangeError("Format string contains an unescaped latin alphabet character `"+u+"`");return{isToken:!1,value:d}});r.localize.preprocessor&&(l=r.localize.preprocessor(a,l));let c={firstWeekContainsDate:i,weekStartsOn:s,locale:r};return l.map(d=>{if(!d.isToken)return d.value;let u=d.value;(!n?.useAdditionalWeekYearTokens&&kT(u)||!n?.useAdditionalDayOfYearTokens&&ST(u))&&NT(u,e,String(t));let p=Ag[u[0]];return p(a,u,r.localize,c)}).join("")}function oH(t){let e=t.match(eH);return e?e[1].replace(tH,"'"):t}function MT(){return Object.assign({},$o())}function Lg(t,e,n){let o=MT(),r=sH(t,n.timeZone,n.locale??o.locale);return"formatToParts"in r?rH(r,e):iH(r,e)}function rH(t,e){let n=t.formatToParts(e);for(let o=n.length-1;o>=0;--o)if(n[o].type==="timeZoneName")return n[o].value}function iH(t,e){let n=t.format(e).replace(/\u200E/g,""),o=/ [\w-+ ]+$/.exec(n);return o?o[0].substr(1):""}function sH(t,e,n){return new Intl.DateTimeFormat(n?[n.code,"en-US"]:void 0,{timeZone:e,timeZoneName:t})}function LT(t,e){let n=uH(e);return"formatToParts"in n?lH(n,t):cH(n,t)}var aH={year:0,month:1,day:2,hour:3,minute:4,second:5};function lH(t,e){try{let n=t.formatToParts(e),o=[];for(let r=0;r<n.length;r++){let i=aH[n[r].type];i!==void 0&&(o[i]=parseInt(n[r].value,10))}return o}catch(n){if(n instanceof RangeError)return[NaN];throw n}}function cH(t,e){let n=t.format(e),o=/(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(n);return[parseInt(o[3],10),parseInt(o[1],10),parseInt(o[2],10),parseInt(o[4],10),parseInt(o[5],10),parseInt(o[6],10)]}var Rg={},AT=new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:"America/New_York",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date("2014-06-25T04:00:00.123Z")),dH=AT==="06/25/2014, 00:00:00"||AT==="\u200E06\u200E/\u200E25\u200E/\u200E2014\u200E \u200E00\u200E:\u200E00\u200E:\u200E00";function uH(t){return Rg[t]||(Rg[t]=dH?new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:t,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:t,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})),Rg[t]}function Gl(t,e,n,o,r,i,s){let a=new Date(0);return a.setUTCFullYear(t,e,n),a.setUTCHours(o,r,i,s),a}var RT=36e5,pH=6e4,Pg={timezone:/([Z+-].*)$/,timezoneZ:/^(Z)$/,timezoneHH:/^([+-]\d{2})$/,timezoneHHMM:/^([+-])(\d{2}):?(\d{2})$/};function gr(t,e,n){if(!t)return 0;let o=Pg.timezoneZ.exec(t);if(o)return 0;let r,i;if(o=Pg.timezoneHH.exec(t),o)return r=parseInt(o[1],10),PT(r)?-(r*RT):NaN;if(o=Pg.timezoneHHMM.exec(t),o){r=parseInt(o[2],10);let s=parseInt(o[3],10);return PT(r,s)?(i=Math.abs(r)*RT+s*pH,o[1]==="+"?-i:i):NaN}if(gH(t)){e=new Date(e||Date.now());let s=n?e:fH(e),a=Fg(s,t);return-(n?a:hH(e,a,t))}return NaN}function fH(t){return Gl(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds())}function Fg(t,e){let n=LT(t,e),o=Gl(n[0],n[1]-1,n[2],n[3]%24,n[4],n[5],0).getTime(),r=t.getTime(),i=r%1e3;return r-=i>=0?i:1e3+i,o-r}function hH(t,e,n){let r=t.getTime()-e,i=Fg(new Date(r),n);if(e===i)return e;r-=i-e;let s=Fg(new Date(r),n);return i===s?i:Math.max(i,s)}function PT(t,e){return-23<=t&&t<=23&&(e==null||0<=e&&e<=59)}var FT={};function gH(t){if(FT[t])return!0;try{return new Intl.DateTimeFormat(void 0,{timeZone:t}),FT[t]=!0,!0}catch{return!1}}var mH=60*1e3,$T={X:function(t,e,n){let o=Bg(n.timeZone,t);if(o===0)return"Z";switch(e){case"X":return BT(o);case"XXXX":case"XX":return da(o);default:return da(o,":")}},x:function(t,e,n){let o=Bg(n.timeZone,t);switch(e){case"x":return BT(o);case"xxxx":case"xx":return da(o);default:return da(o,":")}},O:function(t,e,n){let o=Bg(n.timeZone,t);switch(e){case"O":case"OO":case"OOO":return"GMT"+_H(o,":");default:return"GMT"+da(o,":")}},z:function(t,e,n){switch(e){case"z":case"zz":case"zzz":return Lg("short",t,n);default:return Lg("long",t,n)}}};function Bg(t,e){let n=t?gr(t,e,!0)/mH:e?.getTimezoneOffset()??0;if(Number.isNaN(n))throw new RangeError("Invalid time zone specified: "+t);return n}function pu(t,e){let n=t<0?"-":"",o=Math.abs(t).toString();for(;o.length<e;)o="0"+o;return n+o}function da(t,e=""){let n=t>0?"-":"+",o=Math.abs(t),r=pu(Math.floor(o/60),2),i=pu(Math.floor(o%60),2);return n+r+e+i}function BT(t,e){return t%60===0?(t>0?"-":"+")+pu(Math.abs(t)/60,2):da(t,e)}function _H(t,e=""){let n=t>0?"-":"+",o=Math.abs(t),r=Math.floor(o/60),i=o%60;return i===0?n+String(r):n+String(r)+e+pu(i,2)}function $g(t){let e=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return e.setUTCFullYear(t.getFullYear()),+t-+e}var fu=/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/;var zg=36e5,zT=6e4,bH=2,hn={dateTimePattern:/^([0-9W+-]+)(T| )(.*)/,datePattern:/^([0-9W+-]+)(.*)/,plainTime:/:/,YY:/^(\d{2})$/,YYY:[/^([+-]\d{2})$/,/^([+-]\d{3})$/,/^([+-]\d{4})$/],YYYY:/^(\d{4})/,YYYYY:[/^([+-]\d{4})/,/^([+-]\d{5})/,/^([+-]\d{6})/],MM:/^-(\d{2})$/,DDD:/^-?(\d{3})$/,MMDD:/^-?(\d{2})-?(\d{2})$/,Www:/^-?W(\d{2})$/,WwwD:/^-?W(\d{2})-?(\d{1})$/,HH:/^(\d{2}([.,]\d*)?)$/,HHMM:/^(\d{2}):?(\d{2}([.,]\d*)?)$/,HHMMSS:/^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,timeZone:fu};function ei(t,e={}){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");if(t===null)return new Date(NaN);let n=e.additionalDigits==null?bH:Number(e.additionalDigits);if(n!==2&&n!==1&&n!==0)throw new RangeError("additionalDigits must be 0, 1 or 2");if(t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]")return new Date(t.getTime());if(typeof t=="number"||Object.prototype.toString.call(t)==="[object Number]")return new Date(t);if(Object.prototype.toString.call(t)!=="[object String]")return new Date(NaN);let o=yH(t),{year:r,restDateString:i}=xH(o.date,n),s=vH(i,r);if(s===null||isNaN(s.getTime()))return new Date(NaN);if(s){let a=s.getTime(),l=0,c;if(o.time&&(l=CH(o.time),l===null||isNaN(l)))return new Date(NaN);if(o.timeZone||e.timeZone){if(c=gr(o.timeZone||e.timeZone,new Date(a+l)),isNaN(c))return new Date(NaN)}else c=$g(new Date(a+l)),c=$g(new Date(a+l+c));return new Date(a+l+c)}else return new Date(NaN)}function yH(t){let e={},n=hn.dateTimePattern.exec(t),o;if(n?(e.date=n[1],o=n[3]):(n=hn.datePattern.exec(t),n?(e.date=n[1],o=n[2]):(e.date=null,o=t)),o){let r=hn.timeZone.exec(o);r?(e.time=o.replace(r[1],""),e.timeZone=r[1].trim()):e.time=o}return e}function xH(t,e){if(t){let n=hn.YYY[e],o=hn.YYYYY[e],r=hn.YYYY.exec(t)||o.exec(t);if(r){let i=r[1];return{year:parseInt(i,10),restDateString:t.slice(i.length)}}if(r=hn.YY.exec(t)||n.exec(t),r){let i=r[1];return{year:parseInt(i,10)*100,restDateString:t.slice(i.length)}}}return{year:null}}function vH(t,e){if(e===null)return null;let n,o,r;if(!t||!t.length)return n=new Date(0),n.setUTCFullYear(e),n;let i=hn.MM.exec(t);if(i)return n=new Date(0),o=parseInt(i[1],10)-1,KT(e,o)?(n.setUTCFullYear(e,o),n):new Date(NaN);if(i=hn.DDD.exec(t),i){n=new Date(0);let s=parseInt(i[1],10);return TH(e,s)?(n.setUTCFullYear(e,0,s),n):new Date(NaN)}if(i=hn.MMDD.exec(t),i){n=new Date(0),o=parseInt(i[1],10)-1;let s=parseInt(i[2],10);return KT(e,o,s)?(n.setUTCFullYear(e,o,s),n):new Date(NaN)}if(i=hn.Www.exec(t),i)return r=parseInt(i[1],10)-1,UT(r)?HT(e,r):new Date(NaN);if(i=hn.WwwD.exec(t),i){r=parseInt(i[1],10)-1;let s=parseInt(i[2],10)-1;return UT(r,s)?HT(e,r,s):new Date(NaN)}return null}function CH(t){let e,n,o=hn.HH.exec(t);if(o)return e=parseFloat(o[1].replace(",",".")),Hg(e)?e%24*zg:NaN;if(o=hn.HHMM.exec(t),o)return e=parseInt(o[1],10),n=parseFloat(o[2].replace(",",".")),Hg(e,n)?e%24*zg+n*zT:NaN;if(o=hn.HHMMSS.exec(t),o){e=parseInt(o[1],10),n=parseInt(o[2],10);let r=parseFloat(o[3].replace(",","."));return Hg(e,n,r)?e%24*zg+n*zT+r*1e3:NaN}return null}function HT(t,e,n){e=e||0,n=n||0;let o=new Date(0);o.setUTCFullYear(t,0,4);let r=o.getUTCDay()||7,i=e*7+n+1-r;return o.setUTCDate(o.getUTCDate()+i),o}var EH=[31,28,31,30,31,30,31,31,30,31,30,31],wH=[31,29,31,30,31,30,31,31,30,31,30,31];function jT(t){return t%400===0||t%4===0&&t%100!==0}function KT(t,e,n){if(e<0||e>11)return!1;if(n!=null){if(n<1)return!1;let o=jT(t);if(o&&n>wH[e]||!o&&n>EH[e])return!1}return!0}function TH(t,e){if(e<1)return!1;let n=jT(t);return!(n&&e>366||!n&&e>365)}function UT(t,e){return!(t<0||t>52||e!=null&&(e<0||e>6))}function Hg(t,e,n){return!(t<0||t>=25||e!=null&&(e<0||e>=60)||n!=null&&(n<0||n>=60))}var SH=/([xXOz]+)|''|'(''|[^'])+('|$)/g;function Kg(t,e,n={}){e=String(e);let o=e.match(SH);if(o){let r=ei(n.originalDate||t,n);e=o.reduce(function(i,s){if(s[0]==="'")return i;let a=i.indexOf(s),l=i[a-1]==="'",c=i.replace(s,"'"+$T[s[0]](r,s,n)+"'");return l?c.substring(0,a-1)+c.substring(a+1):c},e)}return IT(t,e,n)}function Ug(t,e,n){t=ei(t,n);let o=gr(e,t,!0),r=new Date(t.getTime()-o),i=new Date(0);return i.setFullYear(r.getUTCFullYear(),r.getUTCMonth(),r.getUTCDate()),i.setHours(r.getUTCHours(),r.getUTCMinutes(),r.getUTCSeconds(),r.getUTCMilliseconds()),i}function jg(t,e,n,o){return o={...o,timeZone:e,originalDate:t},Kg(Ug(t,e,{timeZone:o.timeZone}),n,o)}function Vg(t,e,n){if(typeof t=="string"&&!t.match(fu))return ei(t,{...n,timeZone:e});t=ei(t,n);let o=Gl(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()).getTime(),r=gr(e,new Date(o));return new Date(o+r)}ke();function VT(t){let e=t.field,[n,o]=en(t.deepKey),r=`${kH(t.deepKey)}.timezone`,[i,s]=en(r),a=e.timezone||i||Intl.DateTimeFormat().resolvedOptions().timeZone,l=J(()=>{if(!n)return"";try{return jg(n.toDate(),a,"yyyy-MM-dd'T'HH:mm")}catch(f){return console.error("Error formatting date:",f),""}},[n,a]),[c,d]=R(null),u=(f,h)=>{if(h&&!h.valid){console.warn("Invalid date input"),d("Invalid datetime");return}if(f)try{let m=Vg(f,a);if(isNaN(m.getTime())){console.warn("Invalid date:",f),d("Invalid datetime");return}d(null),o(dd.fromDate(m))}catch(m){console.error("Error parsing date:",m),d("Invalid datetime")}else d(null),o(null)},p=f=>{s(f)};return g("div",{className:"DocEditor__DateTimeField",children:[g("div",{className:"DocEditor__DateTimeField__row",children:[g("input",{type:"datetime-local",value:l,onChange:f=>{let h=f.target;u(h.value,h.validity)},className:"DocEditor__DateTimeField__input"}),e.timezone?g("div",{className:"DocEditor__DateTimeField__timezone",children:["timezone: ",e.timezone]}):g(Ro,{className:"DocEditor__DateTimeField__timezoneSelect",value:a,onChange:f=>{f&&p(f)},data:Intl.supportedValuesOf("timeZone"),searchable:!0,size:"xs"})]}),c&&g("div",{className:"DocEditor__DateTimeField__error",children:c})]})}function kH(t){let e=t.split("."),n=e.pop();return[...e,`@${n}`].join(".")}function WT(t){return g(zd,{...t,variant:"image"})}ke();function GT(t){let e=t.field,[n,o]=en(t.deepKey,[]),r=J(()=>(e.options||[]).map(i=>typeof i=="string"?{label:i,value:i}:{label:i.label??i.value??"",value:i.value??i.label??""}),[e.options]);return g("div",{className:"DocEditor__MultiSelectField",children:g(Gv,{data:r,size:"xs",radius:0,placeholder:e.placeholder,value:n,searchable:!0,creatable:e.creatable||!1,getCreateLabel:i=>`+ Add "${i}"`,onChange:i=>o(i),dropdownComponent:"div"})})}function YT(t){let[e,n]=en(t.deepKey,0);return g(Yv,{size:"xs",radius:0,value:e,onChange:o=>n(o),hideControls:!0})}ke();var qT="ReferenceFieldEditorModal";function hu(){let t=Mt(),e=at();return{open:n=>{t.openContextModal(qT,{...e,className:"ReferenceFieldEditorModalWrap",innerProps:n,title:`Edit ${n.docId}`,size:"xl",overflow:"inside",closeOnClickOutside:!1,closeOnEscape:!1})}}}function Wg(t){let{id:e,context:n,innerProps:o}=t,r=o.docId;return g("div",{className:"ReferenceFieldEditorModal",children:g(SE,{docId:r,autoSave:!1,flushOnStop:!1,children:[g(Ne,{className:"ReferenceFieldEditorModal__DocEditor",docId:o.docId,hideStatusBar:!0}),g(Wg.Footer,{docId:r,onCancel:()=>n.closeModal(e)})]})})}Wg.Footer=t=>{let e=Hn();return g("div",{className:"ReferenceFieldEditorModal__footer",children:[g("div",{className:"ReferenceFieldEditorModal__footer__start",children:g(ee,{component:"a",variant:"default",size:"xs",rightIcon:g(Gs,{size:16}),href:`/cms/content/${t.docId}`,target:"_blank",children:["Open ",t.docId]})}),g(ee,{variant:"default",size:"xs",onClick:t.onCancel,children:"Cancel"}),g(ee,{color:"dark",size:"xs",onClick:async()=>{await e.controller.flush(),t.onCancel()},children:"Save"})]})};Wg.id=qT;function ua(t){let e=t.field,[n,o]=en(t.deepKey),r=n?.id||"";function i(c){o(c?gd(c):null)}let s=Rd(),a=hu();function l(){let c=r?gd(r).collection:e.initialCollection;s.open({collections:e.collections,initialCollection:c,onChange:d=>{i(d),s.close()}})}return g("div",{className:"ReferenceField",children:[r?g("div",{className:"ReferenceField__ref",children:[g(ua.Preview,{id:r}),g("div",{className:"ReferenceField__remove",children:[g(De,{label:"Quick edit",children:g(Pe,{className:"ReferenceField__remove__icon",onClick:()=>a.open({docId:r}),children:g(kd,{size:16})})}),g(De,{label:"Remove",children:g(Pe,{className:"ReferenceField__remove__icon",onClick:()=>o(null),children:g(ho,{size:16})})})]})]}):g("div",{className:"ReferenceField__none",children:"None selected"}),g(ee,{color:"dark",size:"xs",onClick:()=>l(),children:e.buttonLabel||"Select"})]})}ua.Preview=t=>{let[e,n]=R(!0),[o,r]=R(null);async function i(){n(!0),await cr(async()=>{let s=await Cl(t.id);r(s)}),n(!1)}return P(()=>{i()},[t.id]),g("div",{className:"ReferenceField__Preview",children:e?g("div",{className:"ReferenceField__Preview__loading",children:g(Qt,{color:"gray",size:"sm"})}):o?g(ua.DocCard,{doc:o}):g("div",{className:"ReferenceField__Preview__notfound",children:["Doc not found: ",g("b",{children:t.id})," (was it deleted?). Select a new doc or remove using the trash icon to the right."]})})};ua.DocCard=t=>{let e=t.doc,n=e.id||e.sys?.id||"";if(!n)return g("div",{className:"ReferenceField__DocCard ReferenceField__DocCard--error",children:JSON.stringify(e)});let o=gd(n).collection,r=e.fields||{},i=window.__ROOT_CTX.collections[o];if(!i)throw new Error(`could not find collection: ${o}`);let s=Po(r,i.preview?.title||"meta.title"),a=Po(r,i.preview?.image||"meta.image")||i.preview?.defaultImage;return g("a",{className:"ReferenceField__DocCard",href:`/cms/content/${n}`,target:"_blank",children:[g("div",{className:"ReferenceField__DocCard__image",children:g(sd,{src:a?.src,width:80,height:60,withPlaceholder:!a?.src})}),g("div",{className:"ReferenceField__DocCard__content",children:[g("div",{className:"ReferenceField__DocCard__content__header",children:g("div",{className:"ReferenceField__DocCard__content__header__docId",children:n})}),g("div",{className:"ReferenceField__DocCard__content__title",children:s||"[UNTITLED]"})]})]})};ke();function JT(t){let e=t.field,[n,o]=R([]),r=Hn().controller;function i(d){if(d.length){let u=d.map(p=>{let[f,h]=p.split("/");return{id:p,collection:f,slug:h}});r.updateKey(t.deepKey,u)}else r.removeKey(t.deepKey);o(d)}Fo(t.deepKey,d=>{Array.isArray(d)?o(d.map(u=>u.id)):o([])});let s=Rd(),a=hu();function l(){s.open({collections:e.collections,initialCollection:e.initialCollection,multiSelect:!0,selectedDocIds:n,onChangeMulti:(d,u)=>{o(p=>{let f=[...p];if(u)f.includes(d)||f.push(d);else{let h=f.indexOf(d);h>-1&&f.splice(h,1)}return i(f),f})}})}function c(d){let u=n.filter(p=>p!==d);i(u)}return g("div",{className:"ReferencesField",children:[n.length>0?g(ru,{onDragEnd:d=>{let{destination:u,source:p}=d;if(!u||u.index===p.index)return;let f=[...n],[h]=f.splice(p.index,1);f.splice(u.index,0,h),i(f)},children:g(su,{droppableId:"ReferencesField__droppable",direction:"vertical",children:d=>g("div",{ref:d.innerRef,...d.droppableProps,className:"ReferencesField__refs",children:[n.map((u,p)=>g(iu,{draggableId:u,index:p,children:(f,h)=>g("div",{ref:f.innerRef,...f.draggableProps,className:Se("ReferencesField__card",h.isDragging&&"ReferencesField__card--dragging"),children:[g("div",{className:"ReferencesField__card__handle",...f.dragHandleProps,children:g(Ed,{size:16,stroke:"1.5"})}),g(_d,{className:"ReferencesField__card__preview",docId:u,variant:"compact",clickable:!0,statusBadges:!0}),g("div",{className:"ReferencesField__card__controls",children:[g(De,{label:"Quick edit",children:g(Pe,{onClick:()=>a.open({docId:u}),children:g(kd,{size:16})})}),g(De,{label:"Remove",children:g(Pe,{className:"ReferencesField__card__controls__remove",onClick:()=>c(u),children:g(ho,{size:16})})})]})]})},u)),d.placeholder]})})}):g("div",{className:"ReferencesField__none",children:"None selected"}),g(ee,{color:"dark",size:"xs",onClick:()=>l(),children:e.buttonLabel||"Select"})]})}ke();(function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode(".ce-hint--align-start{text-align:left}.ce-hint--align-center{text-align:center}.ce-hint__description{opacity:.6;margin-top:3px}")),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();var ec=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function zu(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function NH(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var n=function o(){return this instanceof o?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(o){var r=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(n,o,r.get?r:{enumerable:!0,get:function(){return t[o]}})}),n}function Gg(){}Object.assign(Gg,{default:Gg,register:Gg,revert:function(){},__esModule:!0});Element.prototype.matches||(Element.prototype.matches=Element.prototype.matchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector||Element.prototype.webkitMatchesSelector||function(t){let e=(this.document||this.ownerDocument).querySelectorAll(t),n=e.length;for(;--n>=0&&e.item(n)!==this;);return n>-1});Element.prototype.closest||(Element.prototype.closest=function(t){let e=this;if(!document.documentElement.contains(e))return null;do{if(e.matches(t))return e;e=e.parentElement||e.parentNode}while(e!==null);return null});Element.prototype.prepend||(Element.prototype.prepend=function(t){let e=document.createDocumentFragment();Array.isArray(t)||(t=[t]),t.forEach(n=>{let o=n instanceof Node;e.appendChild(o?n:document.createTextNode(n))}),this.insertBefore(e,this.firstChild)});Element.prototype.scrollIntoViewIfNeeded||(Element.prototype.scrollIntoViewIfNeeded=function(t){t=arguments.length===0?!0:!!t;let e=this.parentNode,n=window.getComputedStyle(e,null),o=parseInt(n.getPropertyValue("border-top-width")),r=parseInt(n.getPropertyValue("border-left-width")),i=this.offsetTop-e.offsetTop<e.scrollTop,s=this.offsetTop-e.offsetTop+this.clientHeight-o>e.scrollTop+e.clientHeight,a=this.offsetLeft-e.offsetLeft<e.scrollLeft,l=this.offsetLeft-e.offsetLeft+this.clientWidth-r>e.scrollLeft+e.clientWidth,c=i&&!s;(i||s)&&t&&(e.scrollTop=this.offsetTop-e.offsetTop-e.clientHeight/2-o+this.clientHeight/2),(a||l)&&t&&(e.scrollLeft=this.offsetLeft-e.offsetLeft-e.clientWidth/2-r+this.clientWidth/2),(i||s||a||l)&&!t&&this.scrollIntoView(c)});window.requestIdleCallback=window.requestIdleCallback||function(t){let e=Date.now();return setTimeout(function(){t({didTimeout:!1,timeRemaining:function(){return Math.max(0,50-(Date.now()-e))}})},1)};window.cancelIdleCallback=window.cancelIdleCallback||function(t){clearTimeout(t)};var DH=(t=21)=>crypto.getRandomValues(new Uint8Array(t)).reduce((e,n)=>(n&=63,n<36?e+=n.toString(36):n<62?e+=(n-26).toString(36).toUpperCase():n>62?e+="-":e+="_",e),""),dS=(t=>(t.VERBOSE="VERBOSE",t.INFO="INFO",t.WARN="WARN",t.ERROR="ERROR",t))(dS||{}),Ce={BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,LEFT:37,UP:38,DOWN:40,RIGHT:39,DELETE:46,META:91,SLASH:191},OH={LEFT:0,WHEEL:1,RIGHT:2,BACKWARD:3,FORWARD:4};function lc(t,e,n="log",o,r="color: inherit"){if(!("console"in window)||!window.console[n])return;let i=["info","log","warn","error"].includes(n),s=[];switch(lc.logLevel){case"ERROR":if(n!=="error")return;break;case"WARN":if(!["error","warn"].includes(n))return;break;case"INFO":if(!i||t)return;break}o&&s.push(o);let a="Editor.js 2.31.0-rc.7";t&&(i?(s.unshift(`line-height: 1em;
|
|
83
|
-
color: #006FEA;
|
|
84
|
-
display: inline-block;
|
|
85
|
-
font-size: 11px;
|
|
86
|
-
line-height: 1em;
|
|
87
|
-
background-color: #fff;
|
|
88
|
-
padding: 4px 9px;
|
|
89
|
-
border-radius: 30px;
|
|
90
|
-
border: 1px solid rgba(56, 138, 229, 0.16);
|
|
91
|
-
margin: 4px 5px 4px 0;`,r),e=`%c${a}%c ${e}`):e=`( ${a} )${e}`);try{i?o?console[n](`${e} %o`,...s):console[n](e,...s):console[n](e)}catch{}}lc.logLevel="VERBOSE";function IH(t){lc.logLevel=t}var Ue=lc.bind(window,!1),ao=lc.bind(window,!0);function Zi(t){return Object.prototype.toString.call(t).match(/\s([a-zA-Z]+)/)[1].toLowerCase()}function lt(t){return Zi(t)==="function"||Zi(t)==="asyncfunction"}function nn(t){return Zi(t)==="object"}function yr(t){return Zi(t)==="string"}function MH(t){return Zi(t)==="boolean"}function XT(t){return Zi(t)==="number"}function ZT(t){return Zi(t)==="undefined"}function lo(t){return t?Object.keys(t).length===0&&t.constructor===Object:!0}function uS(t){return t>47&&t<58||t===32||t===13||t===229||t>64&&t<91||t>95&&t<112||t>185&&t<193||t>218&&t<223}async function AH(t,e=()=>{},n=()=>{}){async function o(r,i,s){try{await r.function(r.data),await i(ZT(r.data)?{}:r.data)}catch{s(ZT(r.data)?{}:r.data)}}return t.reduce(async(r,i)=>(await r,o(i,e,n)),Promise.resolve())}function pS(t){return Array.prototype.slice.call(t)}function Cu(t,e){return function(){let n=this,o=arguments;window.setTimeout(()=>t.apply(n,o),e)}}function LH(t){return t.name.split(".").pop()}function RH(t){return/^[-\w]+\/([-+\w]+|\*)$/.test(t)}function QT(t,e,n){let o;return(...r)=>{let i=this,s=()=>{o=null,n||t.apply(i,r)},a=n&&!o;window.clearTimeout(o),o=window.setTimeout(s,e),a&&t.apply(i,r)}}function em(t,e,n=void 0){let o,r,i,s=null,a=0;n||(n={});let l=function(){a=n.leading===!1?0:Date.now(),s=null,i=t.apply(o,r),s||(o=r=null)};return function(){let c=Date.now();!a&&n.leading===!1&&(a=c);let d=e-(c-a);return o=this,r=arguments,d<=0||d>e?(s&&(clearTimeout(s),s=null),a=c,i=t.apply(o,r),s||(o=r=null)):!s&&n.trailing!==!1&&(s=setTimeout(l,d)),i}}function PH(){let t={win:!1,mac:!1,x11:!1,linux:!1},e=Object.keys(t).find(n=>window.navigator.appVersion.toLowerCase().indexOf(n)!==-1);return e&&(t[e]=!0),t}function Eu(t){return t[0].toUpperCase()+t.slice(1)}function tm(t,...e){if(!e.length)return t;let n=e.shift();if(nn(t)&&nn(n))for(let o in n)nn(n[o])?(t[o]||Object.assign(t,{[o]:{}}),tm(t[o],n[o])):Object.assign(t,{[o]:n[o]});return tm(t,...e)}function Qm(t){let e=PH();return t=t.replace(/shift/gi,"\u21E7").replace(/backspace/gi,"\u232B").replace(/enter/gi,"\u23CE").replace(/up/gi,"\u2191").replace(/left/gi,"\u2192").replace(/down/gi,"\u2193").replace(/right/gi,"\u2190").replace(/escape/gi,"\u238B").replace(/insert/gi,"Ins").replace(/delete/gi,"\u2421").replace(/\+/gi," + "),e.mac?t=t.replace(/ctrl|cmd/gi,"\u2318").replace(/alt/gi,"\u2325"):t=t.replace(/cmd/gi,"Ctrl").replace(/windows/gi,"WIN"),t}function FH(t){try{return new URL(t).href}catch{}return t.substring(0,2)==="//"?window.location.protocol+t:window.location.origin+t}function BH(){return DH(10)}function $H(t){window.open(t,"_blank")}function zH(t=""){return`${t}${Math.floor(Math.random()*1e8).toString(16)}`}function nm(t,e,n){let o=`\xAB${e}\xBB is deprecated and will be removed in the next major release. Please use the \xAB${n}\xBB instead.`;t&&ao(o,"warn")}function _a(t,e,n){let o=n.value?"value":"get",r=n[o],i=`#${e}Cache`;if(n[o]=function(...s){return this[i]===void 0&&(this[i]=r.apply(this,...s)),this[i]},o==="get"&&n.set){let s=n.set;n.set=function(a){delete t[i],s.apply(this,a)}}return n}var fS=650;function ba(){return window.matchMedia(`(max-width: ${fS}px)`).matches}var om=typeof window<"u"&&window.navigator&&window.navigator.platform&&(/iP(ad|hone|od)/.test(window.navigator.platform)||window.navigator.platform==="MacIntel"&&window.navigator.maxTouchPoints>1);function HH(t,e){let n=Array.isArray(t)||nn(t),o=Array.isArray(e)||nn(e);return n||o?JSON.stringify(t)===JSON.stringify(e):t===e}var z=class t{static isSingleTag(e){return e.tagName&&["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"].includes(e.tagName)}static isLineBreakTag(e){return e&&e.tagName&&["BR","WBR"].includes(e.tagName)}static make(e,n=null,o={}){let r=document.createElement(e);if(Array.isArray(n)){let i=n.filter(s=>s!==void 0);r.classList.add(...i)}else n&&r.classList.add(n);for(let i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i]);return r}static text(e){return document.createTextNode(e)}static append(e,n){Array.isArray(n)?n.forEach(o=>e.appendChild(o)):e.appendChild(n)}static prepend(e,n){Array.isArray(n)?(n=n.reverse(),n.forEach(o=>e.prepend(o))):e.prepend(n)}static swap(e,n){let o=document.createElement("div"),r=e.parentNode;r.insertBefore(o,e),r.insertBefore(e,n),r.insertBefore(n,o),r.removeChild(o)}static find(e=document,n){return e.querySelector(n)}static get(e){return document.getElementById(e)}static findAll(e=document,n){return e.querySelectorAll(n)}static get allInputsSelector(){return"[contenteditable=true], textarea, input:not([type]), "+["text","password","email","number","search","tel","url"].map(e=>`input[type="${e}"]`).join(", ")}static findAllInputs(e){return pS(e.querySelectorAll(t.allInputsSelector)).reduce((n,o)=>t.isNativeInput(o)||t.containsOnlyInlineElements(o)?[...n,o]:[...n,...t.getDeepestBlockElements(o)],[])}static getDeepestNode(e,n=!1){let o=n?"lastChild":"firstChild",r=n?"previousSibling":"nextSibling";if(e&&e.nodeType===Node.ELEMENT_NODE&&e[o]){let i=e[o];if(t.isSingleTag(i)&&!t.isNativeInput(i)&&!t.isLineBreakTag(i))if(i[r])i=i[r];else if(i.parentNode[r])i=i.parentNode[r];else return i.parentNode;return this.getDeepestNode(i,n)}return e}static isElement(e){return XT(e)?!1:e&&e.nodeType&&e.nodeType===Node.ELEMENT_NODE}static isFragment(e){return XT(e)?!1:e&&e.nodeType&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}static isContentEditable(e){return e.contentEditable==="true"}static isNativeInput(e){let n=["INPUT","TEXTAREA"];return e&&e.tagName?n.includes(e.tagName):!1}static canSetCaret(e){let n=!0;if(t.isNativeInput(e))switch(e.type){case"file":case"checkbox":case"radio":case"hidden":case"submit":case"button":case"image":case"reset":n=!1;break}else n=t.isContentEditable(e);return n}static isNodeEmpty(e,n){let o;return this.isSingleTag(e)&&!this.isLineBreakTag(e)?!1:(this.isElement(e)&&this.isNativeInput(e)?o=e.value:o=e.textContent.replace("\u200B",""),n&&(o=o.replace(new RegExp(n,"g"),"")),o.length===0)}static isLeaf(e){return e?e.childNodes.length===0:!1}static isEmpty(e,n){let o=[e];for(;o.length>0;)if(e=o.shift(),!!e){if(this.isLeaf(e)&&!this.isNodeEmpty(e,n))return!1;e.childNodes&&o.push(...Array.from(e.childNodes))}return!0}static isHTMLString(e){let n=t.make("div");return n.innerHTML=e,n.childElementCount>0}static getContentLength(e){return t.isNativeInput(e)?e.value.length:e.nodeType===Node.TEXT_NODE?e.length:e.textContent.length}static get blockElements(){return["address","article","aside","blockquote","canvas","div","dl","dt","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","li","main","nav","noscript","ol","output","p","pre","ruby","section","table","tbody","thead","tr","tfoot","ul","video"]}static containsOnlyInlineElements(e){let n;yr(e)?(n=document.createElement("div"),n.innerHTML=e):n=e;let o=r=>!t.blockElements.includes(r.tagName.toLowerCase())&&Array.from(r.children).every(o);return Array.from(n.children).every(o)}static getDeepestBlockElements(e){return t.containsOnlyInlineElements(e)?[e]:Array.from(e.children).reduce((n,o)=>[...n,...t.getDeepestBlockElements(o)],[])}static getHolder(e){return yr(e)?document.getElementById(e):e}static isAnchor(e){return e.tagName.toLowerCase()==="a"}static offset(e){let n=e.getBoundingClientRect(),o=window.pageXOffset||document.documentElement.scrollLeft,r=window.pageYOffset||document.documentElement.scrollTop,i=n.top+r,s=n.left+o;return{top:i,left:s,bottom:i+n.height,right:s+n.width}}};function KH(t){return!/[^\t\n\r ]/.test(t)}function UH(t){let e=window.getComputedStyle(t),n=parseFloat(e.fontSize),o=parseFloat(e.lineHeight)||n*1.2,r=parseFloat(e.paddingTop),i=parseFloat(e.borderTopWidth),s=parseFloat(e.marginTop),a=n*.8,l=(o-n)/2;return s+i+r+l+a}function hS(t){t.dataset.empty=z.isEmpty(t)?"true":"false"}var jH={blockTunes:{toggler:{"Click to tune":"","or drag to move":""}},inlineToolbar:{converter:{"Convert to":""}},toolbar:{toolbox:{Add:""}},popover:{Filter:"","Nothing found":"","Convert to":""}},VH={Text:"",Link:"",Bold:"",Italic:""},WH={link:{"Add a link":""},stub:{"The block can not be displayed correctly.":""}},GH={delete:{Delete:"","Click to delete":""},moveUp:{"Move up":""},moveDown:{"Move down":""}},gS={ui:jH,toolNames:VH,tools:WH,blockTunes:GH},mS=class pa{static ui(e,n){return pa._t(e,n)}static t(e,n){return pa._t(e,n)}static setDictionary(e){pa.currentDictionary=e}static _t(e,n){let o=pa.getNamespace(e);return!o||!o[n]?n:o[n]}static getNamespace(e){return e.split(".").reduce((n,o)=>!n||!Object.keys(n).length?{}:n[o],pa.currentDictionary)}};mS.currentDictionary=gS;var mn=mS,wu=class extends Error{},Qi=class{constructor(){this.subscribers={}}on(e,n){e in this.subscribers||(this.subscribers[e]=[]),this.subscribers[e].push(n)}once(e,n){e in this.subscribers||(this.subscribers[e]=[]);let o=r=>{let i=n(r),s=this.subscribers[e].indexOf(o);return s!==-1&&this.subscribers[e].splice(s,1),i};this.subscribers[e].push(o)}emit(e,n){lo(this.subscribers)||!this.subscribers[e]||this.subscribers[e].reduce((o,r)=>{let i=r(o);return i!==void 0?i:o},n)}off(e,n){if(this.subscribers[e]===void 0){console.warn(`EventDispatcher .off(): there is no subscribers for event "${e.toString()}". Probably, .off() called before .on()`);return}for(let o=0;o<this.subscribers[e].length;o++)if(this.subscribers[e][o]===n){delete this.subscribers[e][o];break}}destroy(){this.subscribers={}}};function mr(t){Object.setPrototypeOf(this,{get id(){return t.id},get name(){return t.name},get config(){return t.config},get holder(){return t.holder},get isEmpty(){return t.isEmpty},get selected(){return t.selected},set stretched(e){t.stretched=e},get stretched(){return t.stretched},get focusable(){return t.focusable},call(e,n){return t.call(e,n)},save(){return t.save()},validate(e){return t.validate(e)},dispatchChange(){t.dispatchChange()},getActiveToolboxEntry(){return t.getActiveToolboxEntry()}})}var es=class{constructor(){this.allListeners=[]}on(e,n,o,r=!1){let i=zH("l"),s={id:i,element:e,eventType:n,handler:o,options:r};if(!this.findOne(e,n,o))return this.allListeners.push(s),e.addEventListener(n,o,r),i}off(e,n,o,r){let i=this.findAll(e,n,o);i.forEach((s,a)=>{let l=this.allListeners.indexOf(i[a]);l>-1&&(this.allListeners.splice(l,1),s.element.removeEventListener(s.eventType,s.handler,s.options))})}offById(e){let n=this.findById(e);n&&n.element.removeEventListener(n.eventType,n.handler,n.options)}findOne(e,n,o){let r=this.findAll(e,n,o);return r.length>0?r[0]:null}findAll(e,n,o){let r,i=e?this.findByEventTarget(e):[];return e&&n&&o?r=i.filter(s=>s.eventType===n&&s.handler===o):e&&n?r=i.filter(s=>s.eventType===n):r=i,r}removeAll(){this.allListeners.map(e=>{e.element.removeEventListener(e.eventType,e.handler,e.options)}),this.allListeners=[]}destroy(){this.removeAll()}findByEventTarget(e){return this.allListeners.filter(n=>{if(n.element===e)return n})}findByType(e){return this.allListeners.filter(n=>{if(n.eventType===e)return n})}findByHandler(e){return this.allListeners.filter(n=>{if(n.handler===e)return n})}findById(e){return this.allListeners.find(n=>n.id===e)}},Ie=class t{constructor({config:e,eventsDispatcher:n}){if(this.nodes={},this.listeners=new es,this.readOnlyMutableListeners={on:(o,r,i,s=!1)=>{this.mutableListenerIds.push(this.listeners.on(o,r,i,s))},clearAll:()=>{for(let o of this.mutableListenerIds)this.listeners.offById(o);this.mutableListenerIds=[]}},this.mutableListenerIds=[],new.target===t)throw new TypeError("Constructors for abstract class Module are not allowed.");this.config=e,this.eventsDispatcher=n}set state(e){this.Editor=e}removeAllNodes(){for(let e in this.nodes){let n=this.nodes[e];n instanceof HTMLElement&&n.remove()}}get isRtl(){return this.config.i18n.direction==="rtl"}},ge=class t{constructor(){this.instance=null,this.selection=null,this.savedSelectionRange=null,this.isFakeBackgroundEnabled=!1,this.commandBackground="backColor",this.commandRemoveFormat="removeFormat"}static get CSS(){return{editorWrapper:"codex-editor",editorZone:"codex-editor__redactor"}}static get anchorNode(){let e=window.getSelection();return e?e.anchorNode:null}static get anchorElement(){let e=window.getSelection();if(!e)return null;let n=e.anchorNode;return n?z.isElement(n)?n:n.parentElement:null}static get anchorOffset(){let e=window.getSelection();return e?e.anchorOffset:null}static get isCollapsed(){let e=window.getSelection();return e?e.isCollapsed:null}static get isAtEditor(){return this.isSelectionAtEditor(t.get())}static isSelectionAtEditor(e){if(!e)return!1;let n=e.anchorNode||e.focusNode;n&&n.nodeType===Node.TEXT_NODE&&(n=n.parentNode);let o=null;return n&&n instanceof Element&&(o=n.closest(`.${t.CSS.editorZone}`)),o?o.nodeType===Node.ELEMENT_NODE:!1}static isRangeAtEditor(e){if(!e)return;let n=e.startContainer;n&&n.nodeType===Node.TEXT_NODE&&(n=n.parentNode);let o=null;return n&&n instanceof Element&&(o=n.closest(`.${t.CSS.editorZone}`)),o?o.nodeType===Node.ELEMENT_NODE:!1}static get isSelectionExists(){return!!t.get().anchorNode}static get range(){return this.getRangeFromSelection(this.get())}static getRangeFromSelection(e){return e&&e.rangeCount?e.getRangeAt(0):null}static get rect(){let e=document.selection,n,o={x:0,y:0,width:0,height:0};if(e&&e.type!=="Control")return e=e,n=e.createRange(),o.x=n.boundingLeft,o.y=n.boundingTop,o.width=n.boundingWidth,o.height=n.boundingHeight,o;if(!window.getSelection)return Ue("Method window.getSelection is not supported","warn"),o;if(e=window.getSelection(),e.rangeCount===null||isNaN(e.rangeCount))return Ue("Method SelectionUtils.rangeCount is not supported","warn"),o;if(e.rangeCount===0)return o;if(n=e.getRangeAt(0).cloneRange(),n.getBoundingClientRect&&(o=n.getBoundingClientRect()),o.x===0&&o.y===0){let r=document.createElement("span");if(r.getBoundingClientRect){r.appendChild(document.createTextNode("\u200B")),n.insertNode(r),o=r.getBoundingClientRect();let i=r.parentNode;i.removeChild(r),i.normalize()}}return o}static get text(){return window.getSelection?window.getSelection().toString():""}static get(){return window.getSelection()}static setCursor(e,n=0){let o=document.createRange(),r=window.getSelection();return z.isNativeInput(e)?z.canSetCaret(e)?(e.focus(),e.selectionStart=e.selectionEnd=n,e.getBoundingClientRect()):void 0:(o.setStart(e,n),o.setEnd(e,n),r.removeAllRanges(),r.addRange(o),o.getBoundingClientRect())}static isRangeInsideContainer(e){let n=t.range;return n===null?!1:e.contains(n.startContainer)}static addFakeCursor(){let e=t.range;if(e===null)return;let n=z.make("span","codex-editor__fake-cursor");n.dataset.mutationFree="true",e.collapse(),e.insertNode(n)}static isFakeCursorInsideContainer(e){return z.find(e,".codex-editor__fake-cursor")!==null}static removeFakeCursor(e=document.body){let n=z.find(e,".codex-editor__fake-cursor");n&&n.remove()}removeFakeBackground(){this.isFakeBackgroundEnabled&&(this.isFakeBackgroundEnabled=!1,document.execCommand(this.commandRemoveFormat))}setFakeBackground(){document.execCommand(this.commandBackground,!1,"#a8d6ff"),this.isFakeBackgroundEnabled=!0}save(){this.savedSelectionRange=t.range}restore(){if(!this.savedSelectionRange)return;let e=window.getSelection();e.removeAllRanges(),e.addRange(this.savedSelectionRange)}clearSaved(){this.savedSelectionRange=null}collapseToEnd(){let e=window.getSelection(),n=document.createRange();n.selectNodeContents(e.focusNode),n.collapse(!1),e.removeAllRanges(),e.addRange(n)}findParentTag(e,n,o=10){let r=window.getSelection(),i=null;return!r||!r.anchorNode||!r.focusNode?null:([r.anchorNode,r.focusNode].forEach(s=>{let a=o;for(;a>0&&s.parentNode&&!(s.tagName===e&&(i=s,n&&s.classList&&!s.classList.contains(n)&&(i=null),i));)s=s.parentNode,a--}),i)}expandToTag(e){let n=window.getSelection();n.removeAllRanges();let o=document.createRange();o.selectNodeContents(e),n.addRange(o)}};function YH(t,e){let{type:n,target:o,addedNodes:r,removedNodes:i}=t;return t.type==="attributes"&&t.attributeName==="data-empty"?!1:!!(e.contains(o)||n==="childList"&&(Array.from(r).some(s=>s===e)||Array.from(i).some(s=>s===e)))}var rm="redactor dom changed",_S="block changed",bS="fake cursor is about to be toggled",yS="fake cursor have been set",tc="editor mobile layout toggled";function im(t,e){if(!t.conversionConfig)return!1;let n=t.conversionConfig[e];return lt(n)||yr(n)}function Tu(t,e){return im(t.tool,e)}function xS(t,e){return Object.entries(t).some(([n,o])=>e[n]&&HH(e[n],o))}async function vS(t,e){let n=(await t.save()).data,o=e.find(r=>r.name===t.name);return o!==void 0&&!im(o,"export")?[]:e.reduce((r,i)=>{if(!im(i,"import")||i.toolbox===void 0)return r;let s=i.toolbox.filter(a=>{if(lo(a)||a.icon===void 0)return!1;if(a.data!==void 0){if(xS(a.data,n))return!1}else if(i.name===t.name)return!1;return!0});return r.push({...i,toolbox:s}),r},[])}function eS(t,e){return t.mergeable?t.name===e.name?!0:Tu(e,"export")&&Tu(t,"import"):!1}function qH(t,e){let n=e?.export;return lt(n)?n(t):yr(n)?t[n]:(n!==void 0&&Ue("Conversion \xABexport\xBB property must be a string or function. String means key of saved data object to export. Function should export processed string to export."),"")}function tS(t,e,n){let o=e?.import;return lt(o)?o(t,n):yr(o)?{[o]:t}:(o!==void 0&&Ue("Conversion \xABimport\xBB property must be a string or function. String means key of tool data to import. Function accepts a imported string and return composed tool data."),{})}var tt=(t=>(t.Default="default",t.Separator="separator",t.Html="html",t))(tt||{}),_r=(t=>(t.APPEND_CALLBACK="appendCallback",t.RENDERED="rendered",t.MOVED="moved",t.UPDATED="updated",t.REMOVED="removed",t.ON_PASTE="onPaste",t))(_r||{}),go=class t extends Qi{constructor({id:e=BH(),data:n,tool:o,readOnly:r,tunesData:i},s){super(),this.cachedInputs=[],this.toolRenderedElement=null,this.tunesInstances=new Map,this.defaultTunesInstances=new Map,this.unavailableTunesData={},this.inputIndex=0,this.editorEventBus=null,this.handleFocus=()=>{this.dropInputsCache(),this.updateCurrentInput()},this.didMutated=(a=void 0)=>{let l=a===void 0,c=a instanceof InputEvent;!l&&!c&&this.detectToolRootChange(a);let d;l||c?d=!0:d=!(a.length>0&&a.every(u=>{let{addedNodes:p,removedNodes:f,target:h}=u;return[...Array.from(p),...Array.from(f),h].some(m=>(z.isElement(m)||(m=m.parentElement),m&&m.closest('[data-mutation-free="true"]')!==null))})),d&&(this.dropInputsCache(),this.updateCurrentInput(),this.toggleInputsEmptyMark(),this.call("updated"),this.emit("didMutated",this))},this.name=o.name,this.id=e,this.settings=o.settings,this.config=o.settings.config||{},this.editorEventBus=s||null,this.blockAPI=new mr(this),this.tool=o,this.toolInstance=o.create(n,this.blockAPI,r),this.tunes=o.tunes,this.composeTunes(i),this.holder=this.compose(),window.requestIdleCallback(()=>{this.watchBlockMutations(),this.addInputEvents(),this.toggleInputsEmptyMark()})}static get CSS(){return{wrapper:"ce-block",wrapperStretched:"ce-block--stretched",content:"ce-block__content",selected:"ce-block--selected",dropTarget:"ce-block--drop-target"}}get inputs(){if(this.cachedInputs.length!==0)return this.cachedInputs;let e=z.findAllInputs(this.holder);return this.inputIndex>e.length-1&&(this.inputIndex=e.length-1),this.cachedInputs=e,e}get currentInput(){return this.inputs[this.inputIndex]}set currentInput(e){let n=this.inputs.findIndex(o=>o===e||o.contains(e));n!==-1&&(this.inputIndex=n)}get firstInput(){return this.inputs[0]}get lastInput(){let e=this.inputs;return e[e.length-1]}get nextInput(){return this.inputs[this.inputIndex+1]}get previousInput(){return this.inputs[this.inputIndex-1]}get data(){return this.save().then(e=>e&&!lo(e.data)?e.data:{})}get sanitize(){return this.tool.sanitizeConfig}get mergeable(){return lt(this.toolInstance.merge)}get focusable(){return this.inputs.length!==0}get isEmpty(){let e=z.isEmpty(this.pluginsContent,"/"),n=!this.hasMedia;return e&&n}get hasMedia(){let e=["img","iframe","video","audio","source","input","textarea","twitterwidget"];return!!this.holder.querySelector(e.join(","))}set selected(e){var n,o;this.holder.classList.toggle(t.CSS.selected,e);let r=e===!0&&ge.isRangeInsideContainer(this.holder),i=e===!1&&ge.isFakeCursorInsideContainer(this.holder);(r||i)&&((n=this.editorEventBus)==null||n.emit(bS,{state:e}),r?ge.addFakeCursor():ge.removeFakeCursor(this.holder),(o=this.editorEventBus)==null||o.emit(yS,{state:e}))}get selected(){return this.holder.classList.contains(t.CSS.selected)}set stretched(e){this.holder.classList.toggle(t.CSS.wrapperStretched,e)}get stretched(){return this.holder.classList.contains(t.CSS.wrapperStretched)}set dropTarget(e){this.holder.classList.toggle(t.CSS.dropTarget,e)}get pluginsContent(){return this.toolRenderedElement}call(e,n){if(lt(this.toolInstance[e])){e==="appendCallback"&&Ue("`appendCallback` hook is deprecated and will be removed in the next major release. Use `rendered` hook instead","warn");try{this.toolInstance[e].call(this.toolInstance,n)}catch(o){Ue(`Error during '${e}' call: ${o.message}`,"error")}}}async mergeWith(e){await this.toolInstance.merge(e)}async save(){let e=await this.toolInstance.save(this.pluginsContent),n=this.unavailableTunesData;[...this.tunesInstances.entries(),...this.defaultTunesInstances.entries()].forEach(([i,s])=>{if(lt(s.save))try{n[i]=s.save()}catch(a){Ue(`Tune ${s.constructor.name} save method throws an Error %o`,"warn",a)}});let o=window.performance.now(),r;return Promise.resolve(e).then(i=>(r=window.performance.now(),{id:this.id,tool:this.name,data:i,tunes:n,time:r-o})).catch(i=>{Ue(`Saving process for ${this.name} tool failed due to the ${i}`,"log","red")})}async validate(e){let n=!0;return this.toolInstance.validate instanceof Function&&(n=await this.toolInstance.validate(e)),n}getTunes(){let e=[],n=[],o=typeof this.toolInstance.renderSettings=="function"?this.toolInstance.renderSettings():[];return z.isElement(o)?e.push({type:tt.Html,element:o}):Array.isArray(o)?e.push(...o):e.push(o),[...this.tunesInstances.values(),...this.defaultTunesInstances.values()].map(r=>r.render()).forEach(r=>{z.isElement(r)?n.push({type:tt.Html,element:r}):Array.isArray(r)?n.push(...r):n.push(r)}),{toolTunes:e,commonTunes:n}}updateCurrentInput(){this.currentInput=z.isNativeInput(document.activeElement)||!ge.anchorNode?document.activeElement:ge.anchorNode}dispatchChange(){this.didMutated()}destroy(){this.unwatchBlockMutations(),this.removeInputEvents(),super.destroy(),lt(this.toolInstance.destroy)&&this.toolInstance.destroy()}async getActiveToolboxEntry(){let e=this.tool.toolbox;if(e.length===1)return Promise.resolve(this.tool.toolbox[0]);let n=await this.data,o=e;return o?.find(r=>xS(r.data,n))}async exportDataAsString(){let e=await this.data;return qH(e,this.tool.conversionConfig)}compose(){let e=z.make("div",t.CSS.wrapper),n=z.make("div",t.CSS.content),o=this.toolInstance.render();e.setAttribute("data-cy","block-wrapper"),e.dataset.id=this.id,this.toolRenderedElement=o,n.appendChild(this.toolRenderedElement);let r=n;return[...this.tunesInstances.values(),...this.defaultTunesInstances.values()].forEach(i=>{if(lt(i.wrap))try{r=i.wrap(r)}catch(s){Ue(`Tune ${i.constructor.name} wrap method throws an Error %o`,"warn",s)}}),e.appendChild(r),e}composeTunes(e){Array.from(this.tunes.values()).forEach(n=>{(n.isInternal?this.defaultTunesInstances:this.tunesInstances).set(n.name,n.create(e[n.name],this.blockAPI))}),Object.entries(e).forEach(([n,o])=>{this.tunesInstances.has(n)||(this.unavailableTunesData[n]=o)})}addInputEvents(){this.inputs.forEach(e=>{e.addEventListener("focus",this.handleFocus),z.isNativeInput(e)&&e.addEventListener("input",this.didMutated)})}removeInputEvents(){this.inputs.forEach(e=>{e.removeEventListener("focus",this.handleFocus),z.isNativeInput(e)&&e.removeEventListener("input",this.didMutated)})}watchBlockMutations(){var e;this.redactorDomChangedCallback=n=>{let{mutations:o}=n;o.some(r=>YH(r,this.toolRenderedElement))&&this.didMutated(o)},(e=this.editorEventBus)==null||e.on(rm,this.redactorDomChangedCallback)}unwatchBlockMutations(){var e;(e=this.editorEventBus)==null||e.off(rm,this.redactorDomChangedCallback)}detectToolRootChange(e){e.forEach(n=>{if(Array.from(n.removedNodes).includes(this.toolRenderedElement)){let o=n.addedNodes[n.addedNodes.length-1];this.toolRenderedElement=o}})}dropInputsCache(){this.cachedInputs=[]}toggleInputsEmptyMark(){this.inputs.forEach(hS)}},sm=class extends Ie{constructor(){super(...arguments),this.insert=(e=this.config.defaultBlock,n={},o={},r,i,s,a)=>{let l=this.Editor.BlockManager.insert({id:a,tool:e,data:n,index:r,needToFocus:i,replace:s});return new mr(l)},this.composeBlockData=async e=>{let n=this.Editor.Tools.blockTools.get(e);return new go({tool:n,api:this.Editor.API,readOnly:!0,data:{},tunesData:{}}).data},this.update=async(e,n,o)=>{let{BlockManager:r}=this.Editor,i=r.getBlockById(e);if(i===void 0)throw new Error(`Block with id "${e}" not found`);let s=await r.update(i,n,o);return new mr(s)},this.convert=async(e,n,o)=>{var r,i;let{BlockManager:s,Tools:a}=this.Editor,l=s.getBlockById(e);if(!l)throw new Error(`Block with id "${e}" not found`);let c=a.blockTools.get(l.name),d=a.blockTools.get(n);if(!d)throw new Error(`Block Tool with type "${n}" not found`);let u=((r=c?.conversionConfig)==null?void 0:r.export)!==void 0,p=((i=d.conversionConfig)==null?void 0:i.import)!==void 0;if(u&&p){let f=await s.convert(l,n,o);return new mr(f)}else{let f=[u?!1:Eu(l.name),p?!1:Eu(n)].filter(Boolean).join(" and ");throw new Error(`Conversion from "${l.name}" to "${n}" is not possible. ${f} tool(s) should provide a "conversionConfig"`)}},this.insertMany=(e,n=this.Editor.BlockManager.blocks.length-1)=>{this.validateIndex(n);let o=e.map(({id:r,type:i,data:s})=>this.Editor.BlockManager.composeBlock({id:r,tool:i||this.config.defaultBlock,data:s}));return this.Editor.BlockManager.insertMany(o,n),o.map(r=>new mr(r))}}get methods(){return{clear:()=>this.clear(),render:e=>this.render(e),renderFromHTML:e=>this.renderFromHTML(e),delete:e=>this.delete(e),swap:(e,n)=>this.swap(e,n),move:(e,n)=>this.move(e,n),getBlockByIndex:e=>this.getBlockByIndex(e),getById:e=>this.getById(e),getCurrentBlockIndex:()=>this.getCurrentBlockIndex(),getBlockIndex:e=>this.getBlockIndex(e),getBlocksCount:()=>this.getBlocksCount(),getBlockByElement:e=>this.getBlockByElement(e),stretchBlock:(e,n=!0)=>this.stretchBlock(e,n),insertNewBlock:()=>this.insertNewBlock(),insert:this.insert,insertMany:this.insertMany,update:this.update,composeBlockData:this.composeBlockData,convert:this.convert}}getBlocksCount(){return this.Editor.BlockManager.blocks.length}getCurrentBlockIndex(){return this.Editor.BlockManager.currentBlockIndex}getBlockIndex(e){let n=this.Editor.BlockManager.getBlockById(e);if(!n){ao("There is no block with id `"+e+"`","warn");return}return this.Editor.BlockManager.getBlockIndex(n)}getBlockByIndex(e){let n=this.Editor.BlockManager.getBlockByIndex(e);if(n===void 0){ao("There is no block at index `"+e+"`","warn");return}return new mr(n)}getById(e){let n=this.Editor.BlockManager.getBlockById(e);return n===void 0?(ao("There is no block with id `"+e+"`","warn"),null):new mr(n)}getBlockByElement(e){let n=this.Editor.BlockManager.getBlock(e);if(n===void 0){ao("There is no block corresponding to element `"+e+"`","warn");return}return new mr(n)}swap(e,n){Ue("`blocks.swap()` method is deprecated and will be removed in the next major release. Use `block.move()` method instead","info"),this.Editor.BlockManager.swap(e,n)}move(e,n){this.Editor.BlockManager.move(e,n)}delete(e=this.Editor.BlockManager.currentBlockIndex){try{let n=this.Editor.BlockManager.getBlockByIndex(e);this.Editor.BlockManager.removeBlock(n)}catch(n){ao(n,"warn");return}this.Editor.BlockManager.blocks.length===0&&this.Editor.BlockManager.insert(),this.Editor.BlockManager.currentBlock&&this.Editor.Caret.setToBlock(this.Editor.BlockManager.currentBlock,this.Editor.Caret.positions.END),this.Editor.Toolbar.close()}async clear(){await this.Editor.BlockManager.clear(!0),this.Editor.InlineToolbar.close()}async render(e){if(e===void 0||e.blocks===void 0)throw new Error("Incorrect data passed to the render() method");this.Editor.ModificationsObserver.disable(),await this.Editor.BlockManager.clear(),await this.Editor.Renderer.render(e.blocks),this.Editor.ModificationsObserver.enable()}renderFromHTML(e){return this.Editor.BlockManager.clear(),this.Editor.Paste.processText(e,!0)}stretchBlock(e,n=!0){nm(!0,"blocks.stretchBlock()","BlockAPI");let o=this.Editor.BlockManager.getBlockByIndex(e);o&&(o.stretched=n)}insertNewBlock(){Ue("Method blocks.insertNewBlock() is deprecated and it will be removed in the next major release. Use blocks.insert() instead.","warn"),this.insert()}validateIndex(e){if(typeof e!="number")throw new Error("Index should be a number");if(e<0)throw new Error("Index should be greater than or equal to 0");if(e===null)throw new Error("Index should be greater than or equal to 0")}};function JH(t,e){return typeof t=="number"?e.BlockManager.getBlockByIndex(t):typeof t=="string"?e.BlockManager.getBlockById(t):e.BlockManager.getBlockById(t.id)}var am=class extends Ie{constructor(){super(...arguments),this.setToFirstBlock=(e=this.Editor.Caret.positions.DEFAULT,n=0)=>this.Editor.BlockManager.firstBlock?(this.Editor.Caret.setToBlock(this.Editor.BlockManager.firstBlock,e,n),!0):!1,this.setToLastBlock=(e=this.Editor.Caret.positions.DEFAULT,n=0)=>this.Editor.BlockManager.lastBlock?(this.Editor.Caret.setToBlock(this.Editor.BlockManager.lastBlock,e,n),!0):!1,this.setToPreviousBlock=(e=this.Editor.Caret.positions.DEFAULT,n=0)=>this.Editor.BlockManager.previousBlock?(this.Editor.Caret.setToBlock(this.Editor.BlockManager.previousBlock,e,n),!0):!1,this.setToNextBlock=(e=this.Editor.Caret.positions.DEFAULT,n=0)=>this.Editor.BlockManager.nextBlock?(this.Editor.Caret.setToBlock(this.Editor.BlockManager.nextBlock,e,n),!0):!1,this.setToBlock=(e,n=this.Editor.Caret.positions.DEFAULT,o=0)=>{let r=JH(e,this.Editor);return r===void 0?!1:(this.Editor.Caret.setToBlock(r,n,o),!0)},this.focus=(e=!1)=>e?this.setToLastBlock(this.Editor.Caret.positions.END):this.setToFirstBlock(this.Editor.Caret.positions.START)}get methods(){return{setToFirstBlock:this.setToFirstBlock,setToLastBlock:this.setToLastBlock,setToPreviousBlock:this.setToPreviousBlock,setToNextBlock:this.setToNextBlock,setToBlock:this.setToBlock,focus:this.focus}}},lm=class extends Ie{get methods(){return{emit:(e,n)=>this.emit(e,n),off:(e,n)=>this.off(e,n),on:(e,n)=>this.on(e,n)}}on(e,n){this.eventsDispatcher.on(e,n)}emit(e,n){this.eventsDispatcher.emit(e,n)}off(e,n){this.eventsDispatcher.off(e,n)}},cm=class t extends Ie{static getNamespace(e,n){return n?`blockTunes.${e}`:`tools.${e}`}get methods(){return{t:()=>{ao("I18n.t() method can be accessed only from Tools","warn")}}}getMethodsForTool(e,n){return Object.assign(this.methods,{t:o=>mn.t(t.getNamespace(e,n),o)})}},dm=class extends Ie{get methods(){return{blocks:this.Editor.BlocksAPI.methods,caret:this.Editor.CaretAPI.methods,tools:this.Editor.ToolsAPI.methods,events:this.Editor.EventsAPI.methods,listeners:this.Editor.ListenersAPI.methods,notifier:this.Editor.NotifierAPI.methods,sanitizer:this.Editor.SanitizerAPI.methods,saver:this.Editor.SaverAPI.methods,selection:this.Editor.SelectionAPI.methods,styles:this.Editor.StylesAPI.classes,toolbar:this.Editor.ToolbarAPI.methods,inlineToolbar:this.Editor.InlineToolbarAPI.methods,tooltip:this.Editor.TooltipAPI.methods,i18n:this.Editor.I18nAPI.methods,readOnly:this.Editor.ReadOnlyAPI.methods,ui:this.Editor.UiAPI.methods}}getMethodsForTool(e,n){return Object.assign(this.methods,{i18n:this.Editor.I18nAPI.getMethodsForTool(e,n)})}},um=class extends Ie{get methods(){return{close:()=>this.close(),open:()=>this.open()}}open(){this.Editor.InlineToolbar.tryToShow()}close(){this.Editor.InlineToolbar.close()}},pm=class extends Ie{get methods(){return{on:(e,n,o,r)=>this.on(e,n,o,r),off:(e,n,o,r)=>this.off(e,n,o,r),offById:e=>this.offById(e)}}on(e,n,o,r){return this.listeners.on(e,n,o,r)}off(e,n,o,r){this.listeners.off(e,n,o,r)}offById(e){this.listeners.offById(e)}},CS={exports:{}};(function(t,e){(function(n,o){t.exports=o()})(window,function(){return(function(n){var o={};function r(i){if(o[i])return o[i].exports;var s=o[i]={i,l:!1,exports:{}};return n[i].call(s.exports,s,s.exports,r),s.l=!0,s.exports}return r.m=n,r.c=o,r.d=function(i,s,a){r.o(i,s)||Object.defineProperty(i,s,{enumerable:!0,get:a})},r.r=function(i){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(i,"__esModule",{value:!0})},r.t=function(i,s){if(1&s&&(i=r(i)),8&s||4&s&&typeof i=="object"&&i&&i.__esModule)return i;var a=Object.create(null);if(r.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:i}),2&s&&typeof i!="string")for(var l in i)r.d(a,l,(function(c){return i[c]}).bind(null,l));return a},r.n=function(i){var s=i&&i.__esModule?function(){return i.default}:function(){return i};return r.d(s,"a",s),s},r.o=function(i,s){return Object.prototype.hasOwnProperty.call(i,s)},r.p="/",r(r.s=0)})([function(n,o,r){r(1),n.exports=(function(){var i=r(6),s="cdx-notify--bounce-in",a=null;return{show:function(l){if(l.message){(function(){if(a)return!0;a=i.getWrapper(),document.body.appendChild(a)})();var c=null,d=l.time||8e3;switch(l.type){case"confirm":c=i.confirm(l);break;case"prompt":c=i.prompt(l);break;default:c=i.alert(l),window.setTimeout(function(){c.remove()},d)}a.appendChild(c),c.classList.add(s)}}}})()},function(n,o,r){var i=r(2);typeof i=="string"&&(i=[[n.i,i,""]]);var s={hmr:!0,transform:void 0,insertInto:void 0};r(4)(i,s),i.locals&&(n.exports=i.locals)},function(n,o,r){(n.exports=r(3)(!1)).push([n.i,`.cdx-notify--error{background:#fffbfb!important}.cdx-notify--error::before{background:#fb5d5d!important}.cdx-notify__input{max-width:130px;padding:5px 10px;background:#f7f7f7;border:0;border-radius:3px;font-size:13px;color:#656b7c;outline:0}.cdx-notify__input:-ms-input-placeholder{color:#656b7c}.cdx-notify__input::placeholder{color:#656b7c}.cdx-notify__input:focus:-ms-input-placeholder{color:rgba(101,107,124,.3)}.cdx-notify__input:focus::placeholder{color:rgba(101,107,124,.3)}.cdx-notify__button{border:none;border-radius:3px;font-size:13px;padding:5px 10px;cursor:pointer}.cdx-notify__button:last-child{margin-left:10px}.cdx-notify__button--cancel{background:#f2f5f7;box-shadow:0 2px 1px 0 rgba(16,19,29,0);color:#656b7c}.cdx-notify__button--cancel:hover{background:#eee}.cdx-notify__button--confirm{background:#34c992;box-shadow:0 1px 1px 0 rgba(18,49,35,.05);color:#fff}.cdx-notify__button--confirm:hover{background:#33b082}.cdx-notify__btns-wrapper{display:-ms-flexbox;display:flex;-ms-flex-flow:row nowrap;flex-flow:row nowrap;margin-top:5px}.cdx-notify__cross{position:absolute;top:5px;right:5px;width:10px;height:10px;padding:5px;opacity:.54;cursor:pointer}.cdx-notify__cross::after,.cdx-notify__cross::before{content:'';position:absolute;left:9px;top:5px;height:12px;width:2px;background:#575d67}.cdx-notify__cross::before{transform:rotate(-45deg)}.cdx-notify__cross::after{transform:rotate(45deg)}.cdx-notify__cross:hover{opacity:1}.cdx-notifies{position:fixed;z-index:2;bottom:20px;left:20px;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen,Ubuntu,Cantarell,"Fira Sans","Droid Sans","Helvetica Neue",sans-serif}.cdx-notify{position:relative;width:220px;margin-top:15px;padding:13px 16px;background:#fff;box-shadow:0 11px 17px 0 rgba(23,32,61,.13);border-radius:5px;font-size:14px;line-height:1.4em;word-wrap:break-word}.cdx-notify::before{content:'';position:absolute;display:block;top:0;left:0;width:3px;height:calc(100% - 6px);margin:3px;border-radius:5px;background:0 0}@keyframes bounceIn{0%{opacity:0;transform:scale(.3)}50%{opacity:1;transform:scale(1.05)}70%{transform:scale(.9)}100%{transform:scale(1)}}.cdx-notify--bounce-in{animation-name:bounceIn;animation-duration:.6s;animation-iteration-count:1}.cdx-notify--success{background:#fafffe!important}.cdx-notify--success::before{background:#41ffb1!important}`,""])},function(n,o){n.exports=function(r){var i=[];return i.toString=function(){return this.map(function(s){var a=(function(l,c){var d=l[1]||"",u=l[3];if(!u)return d;if(c&&typeof btoa=="function"){var p=(h=u,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(h))))+" */"),f=u.sources.map(function(m){return"/*# sourceURL="+u.sourceRoot+m+" */"});return[d].concat(f).concat([p]).join(`
|
|
92
|
-
`)}var h;return[d].join(`
|
|
93
|
-
`)})(s,r);return s[2]?"@media "+s[2]+"{"+a+"}":a}).join("")},i.i=function(s,a){typeof s=="string"&&(s=[[null,s,""]]);for(var l={},c=0;c<this.length;c++){var d=this[c][0];typeof d=="number"&&(l[d]=!0)}for(c=0;c<s.length;c++){var u=s[c];typeof u[0]=="number"&&l[u[0]]||(a&&!u[2]?u[2]=a:a&&(u[2]="("+u[2]+") and ("+a+")"),i.push(u))}},i}},function(n,o,r){var i,s,a={},l=(i=function(){return window&&document&&document.all&&!window.atob},function(){return s===void 0&&(s=i.apply(this,arguments)),s}),c=(function(T){var w={};return function(S){if(typeof S=="function")return S();if(w[S]===void 0){var N=(function(D){return document.querySelector(D)}).call(this,S);if(window.HTMLIFrameElement&&N instanceof window.HTMLIFrameElement)try{N=N.contentDocument.head}catch{N=null}w[S]=N}return w[S]}})(),d=null,u=0,p=[],f=r(5);function h(T,w){for(var S=0;S<T.length;S++){var N=T[S],D=a[N.id];if(D){D.refs++;for(var O=0;O<D.parts.length;O++)D.parts[O](N.parts[O]);for(;O<N.parts.length;O++)D.parts.push(v(N.parts[O],w))}else{var M=[];for(O=0;O<N.parts.length;O++)M.push(v(N.parts[O],w));a[N.id]={id:N.id,refs:1,parts:M}}}}function m(T,w){for(var S=[],N={},D=0;D<T.length;D++){var O=T[D],M=w.base?O[0]+w.base:O[0],I={css:O[1],media:O[2],sourceMap:O[3]};N[M]?N[M].parts.push(I):S.push(N[M]={id:M,parts:[I]})}return S}function _(T,w){var S=c(T.insertInto);if(!S)throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");var N=p[p.length-1];if(T.insertAt==="top")N?N.nextSibling?S.insertBefore(w,N.nextSibling):S.appendChild(w):S.insertBefore(w,S.firstChild),p.push(w);else if(T.insertAt==="bottom")S.appendChild(w);else{if(typeof T.insertAt!="object"||!T.insertAt.before)throw new Error(`[Style Loader]
|
|
94
|
-
|
|
95
|
-
Invalid value for parameter 'insertAt' ('options.insertAt') found.
|
|
96
|
-
Must be 'top', 'bottom', or Object.
|
|
97
|
-
(https://github.com/webpack-contrib/style-loader#insertat)
|
|
98
|
-
`);var D=c(T.insertInto+" "+T.insertAt.before);S.insertBefore(w,D)}}function b(T){if(T.parentNode===null)return!1;T.parentNode.removeChild(T);var w=p.indexOf(T);w>=0&&p.splice(w,1)}function y(T){var w=document.createElement("style");return T.attrs.type===void 0&&(T.attrs.type="text/css"),x(w,T.attrs),_(T,w),w}function x(T,w){Object.keys(w).forEach(function(S){T.setAttribute(S,w[S])})}function v(T,w){var S,N,D,O;if(w.transform&&T.css){if(!(O=w.transform(T.css)))return function(){};T.css=O}if(w.singleton){var M=u++;S=d||(d=y(w)),N=k.bind(null,S,M,!1),D=k.bind(null,S,M,!0)}else T.sourceMap&&typeof URL=="function"&&typeof URL.createObjectURL=="function"&&typeof URL.revokeObjectURL=="function"&&typeof Blob=="function"&&typeof btoa=="function"?(S=(function(I){var L=document.createElement("link");return I.attrs.type===void 0&&(I.attrs.type="text/css"),I.attrs.rel="stylesheet",x(L,I.attrs),_(I,L),L})(w),N=(function(I,L,K){var W=K.css,q=K.sourceMap,B=L.convertToAbsoluteUrls===void 0&&q;(L.convertToAbsoluteUrls||B)&&(W=f(W)),q&&(W+=`
|
|
99
|
-
/*# sourceMappingURL=data:application/json;base64,`+btoa(unescape(encodeURIComponent(JSON.stringify(q))))+" */");var se=new Blob([W],{type:"text/css"}),me=I.href;I.href=URL.createObjectURL(se),me&&URL.revokeObjectURL(me)}).bind(null,S,w),D=function(){b(S),S.href&&URL.revokeObjectURL(S.href)}):(S=y(w),N=(function(I,L){var K=L.css,W=L.media;if(W&&I.setAttribute("media",W),I.styleSheet)I.styleSheet.cssText=K;else{for(;I.firstChild;)I.removeChild(I.firstChild);I.appendChild(document.createTextNode(K))}}).bind(null,S),D=function(){b(S)});return N(T),function(I){if(I){if(I.css===T.css&&I.media===T.media&&I.sourceMap===T.sourceMap)return;N(T=I)}else D()}}n.exports=function(T,w){if(typeof DEBUG<"u"&&DEBUG&&typeof document!="object")throw new Error("The style-loader cannot be used in a non-browser environment");(w=w||{}).attrs=typeof w.attrs=="object"?w.attrs:{},w.singleton||typeof w.singleton=="boolean"||(w.singleton=l()),w.insertInto||(w.insertInto="head"),w.insertAt||(w.insertAt="bottom");var S=m(T,w);return h(S,w),function(N){for(var D=[],O=0;O<S.length;O++){var M=S[O];(I=a[M.id]).refs--,D.push(I)}for(N&&h(m(N,w),w),O=0;O<D.length;O++){var I;if((I=D[O]).refs===0){for(var L=0;L<I.parts.length;L++)I.parts[L]();delete a[I.id]}}}};var E,C=(E=[],function(T,w){return E[T]=w,E.filter(Boolean).join(`
|
|
100
|
-
`)});function k(T,w,S,N){var D=S?"":N.css;if(T.styleSheet)T.styleSheet.cssText=C(w,D);else{var O=document.createTextNode(D),M=T.childNodes;M[w]&&T.removeChild(M[w]),M.length?T.insertBefore(O,M[w]):T.appendChild(O)}}},function(n,o){n.exports=function(r){var i=typeof window<"u"&&window.location;if(!i)throw new Error("fixUrls requires window.location");if(!r||typeof r!="string")return r;var s=i.protocol+"//"+i.host,a=s+i.pathname.replace(/\/[^\/]*$/,"/");return r.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,function(l,c){var d,u=c.trim().replace(/^"(.*)"$/,function(p,f){return f}).replace(/^'(.*)'$/,function(p,f){return f});return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(u)?l:(d=u.indexOf("//")===0?u:u.indexOf("/")===0?s+u:a+u.replace(/^\.\//,""),"url("+JSON.stringify(d)+")")})}},function(n,o,r){var i,s,a,l,c,d,u,p,f;n.exports=(i="cdx-notifies",s="cdx-notify",a="cdx-notify__cross",l="cdx-notify__button--confirm",c="cdx-notify__button--cancel",d="cdx-notify__input",u="cdx-notify__button",p="cdx-notify__btns-wrapper",{alert:f=function(h){var m=document.createElement("DIV"),_=document.createElement("DIV"),b=h.message,y=h.style;return m.classList.add(s),y&&m.classList.add(s+"--"+y),m.innerHTML=b,_.classList.add(a),_.addEventListener("click",m.remove.bind(m)),m.appendChild(_),m},confirm:function(h){var m=f(h),_=document.createElement("div"),b=document.createElement("button"),y=document.createElement("button"),x=m.querySelector("."+a),v=h.cancelHandler,E=h.okHandler;return _.classList.add(p),b.innerHTML=h.okText||"Confirm",y.innerHTML=h.cancelText||"Cancel",b.classList.add(u),y.classList.add(u),b.classList.add(l),y.classList.add(c),v&&typeof v=="function"&&(y.addEventListener("click",v),x.addEventListener("click",v)),E&&typeof E=="function"&&b.addEventListener("click",E),b.addEventListener("click",m.remove.bind(m)),y.addEventListener("click",m.remove.bind(m)),_.appendChild(b),_.appendChild(y),m.appendChild(_),m},prompt:function(h){var m=f(h),_=document.createElement("div"),b=document.createElement("button"),y=document.createElement("input"),x=m.querySelector("."+a),v=h.cancelHandler,E=h.okHandler;return _.classList.add(p),b.innerHTML=h.okText||"Ok",b.classList.add(u),b.classList.add(l),y.classList.add(d),h.placeholder&&y.setAttribute("placeholder",h.placeholder),h.default&&(y.value=h.default),h.inputType&&(y.type=h.inputType),v&&typeof v=="function"&&x.addEventListener("click",v),E&&typeof E=="function"&&b.addEventListener("click",function(){E(y.value)}),b.addEventListener("click",m.remove.bind(m)),_.appendChild(y),_.appendChild(b),m.appendChild(_),m},getWrapper:function(){var h=document.createElement("DIV");return h.classList.add(i),h}})}])})})(CS);var XH=CS.exports,ZH=zu(XH),fm=class{show(e){ZH.show(e)}},hm=class extends Ie{constructor({config:e,eventsDispatcher:n}){super({config:e,eventsDispatcher:n}),this.notifier=new fm}get methods(){return{show:e=>this.show(e)}}show(e){return this.notifier.show(e)}},gm=class extends Ie{get methods(){let e=()=>this.isEnabled;return{toggle:n=>this.toggle(n),get isEnabled(){return e()}}}toggle(e){return this.Editor.ReadOnly.toggle(e)}get isEnabled(){return this.Editor.ReadOnly.isEnabled}},ES={exports:{}};(function(t,e){(function(n,o){t.exports=o()})(ec,function(){function n(u){var p=u.tags,f=Object.keys(p),h=f.map(function(m){return typeof p[m]}).every(function(m){return m==="object"||m==="boolean"||m==="function"});if(!h)throw new Error("The configuration was invalid");this.config=u}var o=["P","LI","TD","TH","DIV","H1","H2","H3","H4","H5","H6","PRE"];function r(u){return o.indexOf(u.nodeName)!==-1}var i=["A","B","STRONG","I","EM","SUB","SUP","U","STRIKE"];function s(u){return i.indexOf(u.nodeName)!==-1}n.prototype.clean=function(u){let p=document.implementation.createHTMLDocument(),f=p.createElement("div");return f.innerHTML=u,this._sanitize(p,f),f.innerHTML},n.prototype._sanitize=function(u,p){var f=a(u,p),h=f.firstChild();if(h)do{if(h.nodeType===Node.TEXT_NODE)if(h.data.trim()===""&&(h.previousElementSibling&&r(h.previousElementSibling)||h.nextElementSibling&&r(h.nextElementSibling))){p.removeChild(h),this._sanitize(u,p);break}else continue;if(h.nodeType===Node.COMMENT_NODE){p.removeChild(h),this._sanitize(u,p);break}var m=s(h),_;m&&(_=Array.prototype.some.call(h.childNodes,r));var b=!!p.parentNode,y=r(p)&&r(h)&&b,x=h.nodeName.toLowerCase(),v=l(this.config,x,h),E=m&&_;if(E||c(h,v)||!this.config.keepNestedBlockElements&&y){if(!(h.nodeName==="SCRIPT"||h.nodeName==="STYLE"))for(;h.childNodes.length>0;)p.insertBefore(h.childNodes[0],h);p.removeChild(h),this._sanitize(u,p);break}for(var C=0;C<h.attributes.length;C+=1){var k=h.attributes[C];d(k,v,h)&&(h.removeAttribute(k.name),C=C-1)}this._sanitize(u,h)}while(h=f.nextSibling())};function a(u,p){return u.createTreeWalker(p,NodeFilter.SHOW_TEXT|NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_COMMENT,null,!1)}function l(u,p,f){return typeof u.tags[p]=="function"?u.tags[p](f):u.tags[p]}function c(u,p){return typeof p>"u"?!0:typeof p=="boolean"?!p:!1}function d(u,p,f){var h=u.name.toLowerCase();return p===!0?!1:typeof p[h]=="function"?!p[h](u.value,f):typeof p[h]>"u"||p[h]===!1?!0:typeof p[h]=="string"?p[h]!==u.value:!1}return n})})(ES);var QH=ES.exports,e4=zu(QH);function e_(t,e){return t.map(n=>{let o=lt(e)?e(n.tool):e;return lo(o)||(n.data=t_(n.data,o)),n})}function zo(t,e={}){let n={tags:e};return new e4(n).clean(t)}function t_(t,e){return Array.isArray(t)?t4(t,e):nn(t)?n4(t,e):yr(t)?o4(t,e):t}function t4(t,e){return t.map(n=>t_(n,e))}function n4(t,e){let n={};for(let o in t){if(!Object.prototype.hasOwnProperty.call(t,o))continue;let r=t[o],i=r4(e[o])?e[o]:e;n[o]=t_(r,i)}return n}function o4(t,e){return nn(e)?zo(t,e):e===!1?zo(t,{}):t}function r4(t){return nn(t)||MH(t)||lt(t)}var mm=class extends Ie{get methods(){return{clean:(e,n)=>this.clean(e,n)}}clean(e,n){return zo(e,n)}},_m=class extends Ie{get methods(){return{save:()=>this.save()}}save(){let e="Editor's content can not be saved in read-only mode";return this.Editor.ReadOnly.isEnabled?(ao(e,"warn"),Promise.reject(new Error(e))):this.Editor.Saver.save()}},bm=class extends Ie{constructor(){super(...arguments),this.selectionUtils=new ge}get methods(){return{findParentTag:(e,n)=>this.findParentTag(e,n),expandToTag:e=>this.expandToTag(e),save:()=>this.selectionUtils.save(),restore:()=>this.selectionUtils.restore(),setFakeBackground:()=>this.selectionUtils.setFakeBackground(),removeFakeBackground:()=>this.selectionUtils.removeFakeBackground()}}findParentTag(e,n){return this.selectionUtils.findParentTag(e,n)}expandToTag(e){this.selectionUtils.expandToTag(e)}},ym=class extends Ie{get methods(){return{getBlockTools:()=>Array.from(this.Editor.Tools.blockTools.values())}}},xm=class extends Ie{get classes(){return{block:"cdx-block",inlineToolButton:"ce-inline-tool",inlineToolButtonActive:"ce-inline-tool--active",input:"cdx-input",loader:"cdx-loader",button:"cdx-button",settingsButton:"cdx-settings-button",settingsButtonActive:"cdx-settings-button--active"}}},vm=class extends Ie{get methods(){return{close:()=>this.close(),open:()=>this.open(),toggleBlockSettings:e=>this.toggleBlockSettings(e),toggleToolbox:e=>this.toggleToolbox(e)}}open(){this.Editor.Toolbar.moveAndOpen()}close(){this.Editor.Toolbar.close()}toggleBlockSettings(e){if(this.Editor.BlockManager.currentBlockIndex===-1){ao("Could't toggle the Toolbar because there is no block selected ","warn");return}e??!this.Editor.BlockSettings.opened?(this.Editor.Toolbar.moveAndOpen(),this.Editor.BlockSettings.open()):this.Editor.BlockSettings.close()}toggleToolbox(e){if(this.Editor.BlockManager.currentBlockIndex===-1){ao("Could't toggle the Toolbox because there is no block selected ","warn");return}e??!this.Editor.Toolbar.toolbox.opened?(this.Editor.Toolbar.moveAndOpen(),this.Editor.Toolbar.toolbox.open()):this.Editor.Toolbar.toolbox.close()}},wS={exports:{}};(function(t,e){(function(n,o){t.exports=o()})(window,function(){return(function(n){var o={};function r(i){if(o[i])return o[i].exports;var s=o[i]={i,l:!1,exports:{}};return n[i].call(s.exports,s,s.exports,r),s.l=!0,s.exports}return r.m=n,r.c=o,r.d=function(i,s,a){r.o(i,s)||Object.defineProperty(i,s,{enumerable:!0,get:a})},r.r=function(i){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(i,"__esModule",{value:!0})},r.t=function(i,s){if(1&s&&(i=r(i)),8&s||4&s&&typeof i=="object"&&i&&i.__esModule)return i;var a=Object.create(null);if(r.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:i}),2&s&&typeof i!="string")for(var l in i)r.d(a,l,(function(c){return i[c]}).bind(null,l));return a},r.n=function(i){var s=i&&i.__esModule?function(){return i.default}:function(){return i};return r.d(s,"a",s),s},r.o=function(i,s){return Object.prototype.hasOwnProperty.call(i,s)},r.p="",r(r.s=0)})([function(n,o,r){n.exports=r(1)},function(n,o,r){r.r(o),r.d(o,"default",function(){return i});class i{constructor(){this.nodes={wrapper:null,content:null},this.showed=!1,this.offsetTop=10,this.offsetLeft=10,this.offsetRight=10,this.hidingDelay=0,this.handleWindowScroll=()=>{this.showed&&this.hide(!0)},this.loadStyles(),this.prepare(),window.addEventListener("scroll",this.handleWindowScroll,{passive:!0})}get CSS(){return{tooltip:"ct",tooltipContent:"ct__content",tooltipShown:"ct--shown",placement:{left:"ct--left",bottom:"ct--bottom",right:"ct--right",top:"ct--top"}}}show(a,l,c){this.nodes.wrapper||this.prepare(),this.hidingTimeout&&clearTimeout(this.hidingTimeout);let d=Object.assign({placement:"bottom",marginTop:0,marginLeft:0,marginRight:0,marginBottom:0,delay:70,hidingDelay:0},c);if(d.hidingDelay&&(this.hidingDelay=d.hidingDelay),this.nodes.content.innerHTML="",typeof l=="string")this.nodes.content.appendChild(document.createTextNode(l));else{if(!(l instanceof Node))throw Error("[CodeX Tooltip] Wrong type of \xABcontent\xBB passed. It should be an instance of Node or String. But "+typeof l+" given.");this.nodes.content.appendChild(l)}switch(this.nodes.wrapper.classList.remove(...Object.values(this.CSS.placement)),d.placement){case"top":this.placeTop(a,d);break;case"left":this.placeLeft(a,d);break;case"right":this.placeRight(a,d);break;default:this.placeBottom(a,d)}d&&d.delay?this.showingTimeout=setTimeout(()=>{this.nodes.wrapper.classList.add(this.CSS.tooltipShown),this.showed=!0},d.delay):(this.nodes.wrapper.classList.add(this.CSS.tooltipShown),this.showed=!0)}hide(a=!1){if(this.hidingDelay&&!a)return this.hidingTimeout&&clearTimeout(this.hidingTimeout),void(this.hidingTimeout=setTimeout(()=>{this.hide(!0)},this.hidingDelay));this.nodes.wrapper.classList.remove(this.CSS.tooltipShown),this.showed=!1,this.showingTimeout&&clearTimeout(this.showingTimeout)}onHover(a,l,c){a.addEventListener("mouseenter",()=>{this.show(a,l,c)}),a.addEventListener("mouseleave",()=>{this.hide()})}destroy(){this.nodes.wrapper.remove(),window.removeEventListener("scroll",this.handleWindowScroll)}prepare(){this.nodes.wrapper=this.make("div",this.CSS.tooltip),this.nodes.content=this.make("div",this.CSS.tooltipContent),this.append(this.nodes.wrapper,this.nodes.content),this.append(document.body,this.nodes.wrapper)}loadStyles(){let a="codex-tooltips-style";if(document.getElementById(a))return;let l=r(2),c=this.make("style",null,{textContent:l.toString(),id:a});this.prepend(document.head,c)}placeBottom(a,l){let c=a.getBoundingClientRect(),d=c.left+a.clientWidth/2-this.nodes.wrapper.offsetWidth/2,u=c.bottom+window.pageYOffset+this.offsetTop+l.marginTop;this.applyPlacement("bottom",d,u)}placeTop(a,l){let c=a.getBoundingClientRect(),d=c.left+a.clientWidth/2-this.nodes.wrapper.offsetWidth/2,u=c.top+window.pageYOffset-this.nodes.wrapper.clientHeight-this.offsetTop;this.applyPlacement("top",d,u)}placeLeft(a,l){let c=a.getBoundingClientRect(),d=c.left-this.nodes.wrapper.offsetWidth-this.offsetLeft-l.marginLeft,u=c.top+window.pageYOffset+a.clientHeight/2-this.nodes.wrapper.offsetHeight/2;this.applyPlacement("left",d,u)}placeRight(a,l){let c=a.getBoundingClientRect(),d=c.right+this.offsetRight+l.marginRight,u=c.top+window.pageYOffset+a.clientHeight/2-this.nodes.wrapper.offsetHeight/2;this.applyPlacement("right",d,u)}applyPlacement(a,l,c){this.nodes.wrapper.classList.add(this.CSS.placement[a]),this.nodes.wrapper.style.left=l+"px",this.nodes.wrapper.style.top=c+"px"}make(a,l=null,c={}){let d=document.createElement(a);Array.isArray(l)?d.classList.add(...l):l&&d.classList.add(l);for(let u in c)c.hasOwnProperty(u)&&(d[u]=c[u]);return d}append(a,l){Array.isArray(l)?l.forEach(c=>a.appendChild(c)):a.appendChild(l)}prepend(a,l){Array.isArray(l)?(l=l.reverse()).forEach(c=>a.prepend(c)):a.prepend(l)}}},function(n,o){n.exports=`.ct{z-index:999;opacity:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;pointer-events:none;-webkit-transition:opacity 50ms ease-in,-webkit-transform 70ms cubic-bezier(.215,.61,.355,1);transition:opacity 50ms ease-in,-webkit-transform 70ms cubic-bezier(.215,.61,.355,1);transition:opacity 50ms ease-in,transform 70ms cubic-bezier(.215,.61,.355,1);transition:opacity 50ms ease-in,transform 70ms cubic-bezier(.215,.61,.355,1),-webkit-transform 70ms cubic-bezier(.215,.61,.355,1);will-change:opacity,top,left;-webkit-box-shadow:0 8px 12px 0 rgba(29,32,43,.17),0 4px 5px -3px rgba(5,6,12,.49);box-shadow:0 8px 12px 0 rgba(29,32,43,.17),0 4px 5px -3px rgba(5,6,12,.49);border-radius:9px}.ct,.ct:before{position:absolute;top:0;left:0}.ct:before{content:"";bottom:0;right:0;background-color:#1d202b;z-index:-1;border-radius:4px}@supports(-webkit-mask-box-image:url("")){.ct:before{border-radius:0;-webkit-mask-box-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path d="M10.71 0h2.58c3.02 0 4.64.42 6.1 1.2a8.18 8.18 0 013.4 3.4C23.6 6.07 24 7.7 24 10.71v2.58c0 3.02-.42 4.64-1.2 6.1a8.18 8.18 0 01-3.4 3.4c-1.47.8-3.1 1.21-6.11 1.21H10.7c-3.02 0-4.64-.42-6.1-1.2a8.18 8.18 0 01-3.4-3.4C.4 17.93 0 16.3 0 13.29V10.7c0-3.02.42-4.64 1.2-6.1a8.18 8.18 0 013.4-3.4C6.07.4 7.7 0 10.71 0z"/></svg>') 48% 41% 37.9% 53.3%}}@media (--mobile){.ct{display:none}}.ct__content{padding:6px 10px;color:#cdd1e0;font-size:12px;text-align:center;letter-spacing:.02em;line-height:1em}.ct:after{content:"";width:8px;height:8px;position:absolute;background-color:#1d202b;z-index:-1}.ct--bottom{-webkit-transform:translateY(5px);transform:translateY(5px)}.ct--bottom:after{top:-3px;left:50%;-webkit-transform:translateX(-50%) rotate(-45deg);transform:translateX(-50%) rotate(-45deg)}.ct--top{-webkit-transform:translateY(-5px);transform:translateY(-5px)}.ct--top:after{top:auto;bottom:-3px;left:50%;-webkit-transform:translateX(-50%) rotate(-45deg);transform:translateX(-50%) rotate(-45deg)}.ct--left{-webkit-transform:translateX(-5px);transform:translateX(-5px)}.ct--left:after{top:50%;left:auto;right:0;-webkit-transform:translate(41.6%,-50%) rotate(-45deg);transform:translate(41.6%,-50%) rotate(-45deg)}.ct--right{-webkit-transform:translateX(5px);transform:translateX(5px)}.ct--right:after{top:50%;left:0;-webkit-transform:translate(-41.6%,-50%) rotate(-45deg);transform:translate(-41.6%,-50%) rotate(-45deg)}.ct--shown{opacity:1;-webkit-transform:none;transform:none}`}]).default})})(wS);var i4=wS.exports,s4=zu(i4),mo=null;function n_(){mo||(mo=new s4)}function a4(t,e,n){n_(),mo?.show(t,e,n)}function Su(t=!1){n_(),mo?.hide(t)}function ku(t,e,n){n_(),mo?.onHover(t,e,n)}function l4(){mo?.destroy(),mo=null}var Cm=class extends Ie{constructor({config:e,eventsDispatcher:n}){super({config:e,eventsDispatcher:n})}get methods(){return{show:(e,n,o)=>this.show(e,n,o),hide:()=>this.hide(),onHover:(e,n,o)=>this.onHover(e,n,o)}}show(e,n,o){a4(e,n,o)}hide(){Su()}onHover(e,n,o){ku(e,n,o)}},Em=class extends Ie{get methods(){return{nodes:this.editorNodes}}get editorNodes(){return{wrapper:this.Editor.UI.nodes.wrapper,redactor:this.Editor.UI.nodes.redactor}}};function TS(t,e){let n={};return Object.entries(t).forEach(([o,r])=>{if(nn(r)){let i=e?`${e}.${o}`:o;Object.values(r).every(s=>yr(s))?n[o]=i:n[o]=TS(r,i);return}n[o]=r}),n}var Gn=TS(gS);function c4(t,e){let n={};return Object.keys(t).forEach(o=>{let r=e[o];r!==void 0?n[r]=t[o]:n[o]=t[o]}),n}var SS=class Xl{constructor(e,n){this.cursor=-1,this.items=[],this.items=e||[],this.focusedCssClass=n}get currentItem(){return this.cursor===-1?null:this.items[this.cursor]}setCursor(e){e<this.items.length&&e>=-1&&(this.dropCursor(),this.cursor=e,this.items[this.cursor].classList.add(this.focusedCssClass))}setItems(e){this.items=e}next(){this.cursor=this.leafNodesAndReturnIndex(Xl.directions.RIGHT)}previous(){this.cursor=this.leafNodesAndReturnIndex(Xl.directions.LEFT)}dropCursor(){this.cursor!==-1&&(this.items[this.cursor].classList.remove(this.focusedCssClass),this.cursor=-1)}leafNodesAndReturnIndex(e){if(this.items.length===0)return this.cursor;let n=this.cursor;return n===-1?n=e===Xl.directions.RIGHT?-1:0:this.items[n].classList.remove(this.focusedCssClass),e===Xl.directions.RIGHT?n=(n+1)%this.items.length:n=(this.items.length+n-1)%this.items.length,z.canSetCaret(this.items[n])&&Cu(()=>ge.setCursor(this.items[n]),50)(),this.items[n].classList.add(this.focusedCssClass),n}};SS.directions={RIGHT:"right",LEFT:"left"};var Yl=SS,ga=class t{constructor(e){this.iterator=null,this.activated=!1,this.flipCallbacks=[],this.onKeyDown=n=>{if(this.isEventReadyForHandling(n))switch(t.usedKeys.includes(n.keyCode)&&n.preventDefault(),n.keyCode){case Ce.TAB:this.handleTabPress(n);break;case Ce.LEFT:case Ce.UP:this.flipLeft();break;case Ce.RIGHT:case Ce.DOWN:this.flipRight();break;case Ce.ENTER:this.handleEnterPress(n);break}},this.iterator=new Yl(e.items,e.focusedItemClass),this.activateCallback=e.activateCallback,this.allowedKeys=e.allowedKeys||t.usedKeys}get isActivated(){return this.activated}static get usedKeys(){return[Ce.TAB,Ce.LEFT,Ce.RIGHT,Ce.ENTER,Ce.UP,Ce.DOWN]}activate(e,n){this.activated=!0,e&&this.iterator.setItems(e),n!==void 0&&this.iterator.setCursor(n),document.addEventListener("keydown",this.onKeyDown,!0)}deactivate(){this.activated=!1,this.dropCursor(),document.removeEventListener("keydown",this.onKeyDown)}focusFirst(){this.dropCursor(),this.flipRight()}flipLeft(){this.iterator.previous(),this.flipCallback()}flipRight(){this.iterator.next(),this.flipCallback()}hasFocus(){return!!this.iterator.currentItem}onFlip(e){this.flipCallbacks.push(e)}removeOnFlip(e){this.flipCallbacks=this.flipCallbacks.filter(n=>n!==e)}dropCursor(){this.iterator.dropCursor()}isEventReadyForHandling(e){return this.activated&&this.allowedKeys.includes(e.keyCode)}handleTabPress(e){switch(e.shiftKey?Yl.directions.LEFT:Yl.directions.RIGHT){case Yl.directions.RIGHT:this.flipRight();break;case Yl.directions.LEFT:this.flipLeft();break}}handleEnterPress(e){this.activated&&(this.iterator.currentItem&&(e.stopPropagation(),e.preventDefault(),this.iterator.currentItem.click()),lt(this.activateCallback)&&this.activateCallback(this.iterator.currentItem))}flipCallback(){this.iterator.currentItem&&this.iterator.currentItem.scrollIntoViewIfNeeded(),this.flipCallbacks.forEach(e=>e())}},d4='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M9 12L9 7.1C9 7.04477 9.04477 7 9.1 7H10.4C11.5 7 14 7.1 14 9.5C14 9.5 14 12 11 12M9 12V16.8C9 16.9105 9.08954 17 9.2 17H12.5C14 17 15 16 15 14.5C15 11.7046 11 12 11 12M9 12H11"/></svg>',u4='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M7 10L11.8586 14.8586C11.9367 14.9367 12.0633 14.9367 12.1414 14.8586L17 10"/></svg>',p4='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M14.5 17.5L9.64142 12.6414C9.56331 12.5633 9.56331 12.4367 9.64142 12.3586L14.5 7.5"/></svg>',f4='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M9.58284 17.5L14.4414 12.6414C14.5195 12.5633 14.5195 12.4367 14.4414 12.3586L9.58284 7.5"/></svg>',h4='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M7 15L11.8586 10.1414C11.9367 10.0633 12.0633 10.0633 12.1414 10.1414L17 15"/></svg>',g4='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M8 8L12 12M12 12L16 16M12 12L16 8M12 12L8 16"/></svg>',m4='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><circle cx="12" cy="12" r="4" stroke="currentColor" stroke-width="2"/></svg>',_4='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M13.34 10C12.4223 12.7337 11 17 11 17"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M14.21 7H14.2"/></svg>',nS='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M7.69998 12.6L7.67896 12.62C6.53993 13.7048 6.52012 15.5155 7.63516 16.625V16.625C8.72293 17.7073 10.4799 17.7102 11.5712 16.6314L13.0263 15.193C14.0703 14.1609 14.2141 12.525 13.3662 11.3266L13.22 11.12"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M16.22 11.12L16.3564 10.9805C17.2895 10.0265 17.3478 8.5207 16.4914 7.49733V7.49733C15.5691 6.39509 13.9269 6.25143 12.8271 7.17675L11.3901 8.38588C10.0935 9.47674 9.95706 11.4241 11.0888 12.6852L11.12 12.72"/></svg>',b4='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2.6" d="M9.40999 7.29999H9.4"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2.6" d="M14.6 7.29999H14.59"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2.6" d="M9.30999 12H9.3"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2.6" d="M14.6 12H14.59"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2.6" d="M9.40999 16.7H9.4"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2.6" d="M14.6 16.7H14.59"/></svg>',y4='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M12 7V12M12 17V12M17 12H12M12 12H7"/></svg>',kS='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M11.5 17.5L5 11M5 11V15.5M5 11H9.5"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M12.5 6.5L19 13M19 13V8.5M19 13H14.5"/></svg>',x4='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><circle cx="10.5" cy="10.5" r="5.5" stroke="currentColor" stroke-width="2"/><line x1="15.4142" x2="19" y1="15" y2="18.5858" stroke="currentColor" stroke-linecap="round" stroke-width="2"/></svg>',v4='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M15.7795 11.5C15.7795 11.5 16.053 11.1962 16.5497 10.6722C17.4442 9.72856 17.4701 8.2475 16.5781 7.30145V7.30145C15.6482 6.31522 14.0873 6.29227 13.1288 7.25073L11.8796 8.49999"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M8.24517 12.3883C8.24517 12.3883 7.97171 12.6922 7.47504 13.2161C6.58051 14.1598 6.55467 15.6408 7.44666 16.5869V16.5869C8.37653 17.5731 9.93744 17.5961 10.8959 16.6376L12.1452 15.3883"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M17.7802 15.1032L16.597 14.9422C16.0109 14.8624 15.4841 15.3059 15.4627 15.8969L15.4199 17.0818"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M6.39064 9.03238L7.58432 9.06668C8.17551 9.08366 8.6522 8.58665 8.61056 7.99669L8.5271 6.81397"/><line x1="12.1142" x2="11.7" y1="12.2" y2="11.7858" stroke="currentColor" stroke-linecap="round" stroke-width="2"/></svg>',C4='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><rect width="14" height="14" x="5" y="5" stroke="currentColor" stroke-width="2" rx="4"/><line x1="12" x2="12" y1="9" y2="12" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M12 15.02V15.01"/></svg>',E4="__",w4="--";function ni(t){return(e,n)=>[[t,e].filter(o=>!!o).join(E4),n].filter(o=>!!o).join(w4)}var ql=ni("ce-hint"),Jl={root:ql(),alignedStart:ql(null,"align-left"),alignedCenter:ql(null,"align-center"),title:ql("title"),description:ql("description")},wm=class{constructor(e){this.nodes={root:z.make("div",[Jl.root,e.alignment==="center"?Jl.alignedCenter:Jl.alignedStart]),title:z.make("div",Jl.title,{textContent:e.title})},this.nodes.root.appendChild(this.nodes.title),e.description!==void 0&&(this.nodes.description=z.make("div",Jl.description,{textContent:e.description}),this.nodes.root.appendChild(this.nodes.description))}getElement(){return this.nodes.root}},nc=class{constructor(e){this.params=e}get name(){if(this.params!==void 0&&"name"in this.params)return this.params.name}destroy(){Su()}onChildrenOpen(){var e;this.params!==void 0&&"children"in this.params&&typeof((e=this.params.children)==null?void 0:e.onOpen)=="function"&&this.params.children.onOpen()}onChildrenClose(){var e;this.params!==void 0&&"children"in this.params&&typeof((e=this.params.children)==null?void 0:e.onClose)=="function"&&this.params.children.onClose()}handleClick(){var e,n;this.params!==void 0&&"onActivate"in this.params&&((n=(e=this.params).onActivate)==null||n.call(e,this.params))}addHint(e,n){let o=new wm(n);ku(e,o.getElement(),{placement:n.position,hidingDelay:100})}get children(){var e;return this.params!==void 0&&"children"in this.params&&((e=this.params.children)==null?void 0:e.items)!==void 0?this.params.children.items:[]}get hasChildren(){return this.children.length>0}get isChildrenOpen(){var e;return this.params!==void 0&&"children"in this.params&&((e=this.params.children)==null?void 0:e.isOpen)===!0}get isChildrenFlippable(){var e;return!(this.params===void 0||!("children"in this.params)||((e=this.params.children)==null?void 0:e.isFlippable)===!1)}get isChildrenSearchable(){var e;return this.params!==void 0&&"children"in this.params&&((e=this.params.children)==null?void 0:e.searchable)===!0}get closeOnActivate(){return this.params!==void 0&&"closeOnActivate"in this.params&&this.params.closeOnActivate}get isActive(){return this.params===void 0||!("isActive"in this.params)?!1:typeof this.params.isActive=="function"?this.params.isActive():this.params.isActive===!0}},Wn=ni("ce-popover-item"),ht={container:Wn(),active:Wn(null,"active"),disabled:Wn(null,"disabled"),focused:Wn(null,"focused"),hidden:Wn(null,"hidden"),confirmationState:Wn(null,"confirmation"),noHover:Wn(null,"no-hover"),noFocus:Wn(null,"no-focus"),title:Wn("title"),secondaryTitle:Wn("secondary-title"),icon:Wn("icon"),iconTool:Wn("icon","tool"),iconChevronRight:Wn("icon","chevron-right"),wobbleAnimation:ni("wobble")()},br=class extends nc{constructor(e,n){super(e),this.params=e,this.nodes={root:null,icon:null},this.confirmationState=null,this.removeSpecialFocusBehavior=()=>{var o;(o=this.nodes.root)==null||o.classList.remove(ht.noFocus)},this.removeSpecialHoverBehavior=()=>{var o;(o=this.nodes.root)==null||o.classList.remove(ht.noHover)},this.onErrorAnimationEnd=()=>{var o,r;(o=this.nodes.icon)==null||o.classList.remove(ht.wobbleAnimation),(r=this.nodes.icon)==null||r.removeEventListener("animationend",this.onErrorAnimationEnd)},this.nodes.root=this.make(e,n)}get isDisabled(){return this.params.isDisabled===!0}get toggle(){return this.params.toggle}get title(){return this.params.title}get isConfirmationStateEnabled(){return this.confirmationState!==null}get isFocused(){return this.nodes.root===null?!1:this.nodes.root.classList.contains(ht.focused)}getElement(){return this.nodes.root}handleClick(){if(this.isConfirmationStateEnabled&&this.confirmationState!==null){this.activateOrEnableConfirmationMode(this.confirmationState);return}this.activateOrEnableConfirmationMode(this.params)}toggleActive(e){var n;(n=this.nodes.root)==null||n.classList.toggle(ht.active,e)}toggleHidden(e){var n;(n=this.nodes.root)==null||n.classList.toggle(ht.hidden,e)}reset(){this.isConfirmationStateEnabled&&this.disableConfirmationMode()}onFocus(){this.disableSpecialHoverAndFocusBehavior()}make(e,n){var o,r;let i=n?.wrapperTag||"div",s=z.make(i,ht.container,{type:i==="button"?"button":void 0});return e.name&&(s.dataset.itemName=e.name),this.nodes.icon=z.make("div",[ht.icon,ht.iconTool],{innerHTML:e.icon||m4}),s.appendChild(this.nodes.icon),e.title!==void 0&&s.appendChild(z.make("div",ht.title,{innerHTML:e.title||""})),e.secondaryLabel&&s.appendChild(z.make("div",ht.secondaryTitle,{textContent:e.secondaryLabel})),this.hasChildren&&s.appendChild(z.make("div",[ht.icon,ht.iconChevronRight],{innerHTML:f4})),this.isActive&&s.classList.add(ht.active),e.isDisabled&&s.classList.add(ht.disabled),e.hint!==void 0&&((o=n?.hint)==null?void 0:o.enabled)!==!1&&this.addHint(s,{...e.hint,position:((r=n?.hint)==null?void 0:r.position)||"right"}),s}enableConfirmationMode(e){if(this.nodes.root===null)return;let n={...this.params,...e,confirmation:"confirmation"in e?e.confirmation:void 0},o=this.make(n);this.nodes.root.innerHTML=o.innerHTML,this.nodes.root.classList.add(ht.confirmationState),this.confirmationState=e,this.enableSpecialHoverAndFocusBehavior()}disableConfirmationMode(){if(this.nodes.root===null)return;let e=this.make(this.params);this.nodes.root.innerHTML=e.innerHTML,this.nodes.root.classList.remove(ht.confirmationState),this.confirmationState=null,this.disableSpecialHoverAndFocusBehavior()}enableSpecialHoverAndFocusBehavior(){var e,n,o;(e=this.nodes.root)==null||e.classList.add(ht.noHover),(n=this.nodes.root)==null||n.classList.add(ht.noFocus),(o=this.nodes.root)==null||o.addEventListener("mouseleave",this.removeSpecialHoverBehavior,{once:!0})}disableSpecialHoverAndFocusBehavior(){var e;this.removeSpecialFocusBehavior(),this.removeSpecialHoverBehavior(),(e=this.nodes.root)==null||e.removeEventListener("mouseleave",this.removeSpecialHoverBehavior)}activateOrEnableConfirmationMode(e){var n;if(!("confirmation"in e)||e.confirmation===void 0)try{(n=e.onActivate)==null||n.call(e,e),this.disableConfirmationMode()}catch{this.animateError()}else this.enableConfirmationMode(e.confirmation)}animateError(){var e,n,o;(e=this.nodes.icon)!=null&&e.classList.contains(ht.wobbleAnimation)||((n=this.nodes.icon)==null||n.classList.add(ht.wobbleAnimation),(o=this.nodes.icon)==null||o.addEventListener("animationend",this.onErrorAnimationEnd))}},Yg=ni("ce-popover-item-separator"),qg={container:Yg(),line:Yg("line"),hidden:Yg(null,"hidden")},Nu=class extends nc{constructor(){super(),this.nodes={root:z.make("div",qg.container),line:z.make("div",qg.line)},this.nodes.root.appendChild(this.nodes.line)}getElement(){return this.nodes.root}toggleHidden(e){var n;(n=this.nodes.root)==null||n.classList.toggle(qg.hidden,e)}},Ho=(t=>(t.Closed="closed",t.ClosedOnActivate="closed-on-activate",t))(Ho||{}),gn=ni("ce-popover"),xt={popover:gn(),popoverContainer:gn("container"),popoverOpenTop:gn(null,"open-top"),popoverOpenLeft:gn(null,"open-left"),popoverOpened:gn(null,"opened"),search:gn("search"),nothingFoundMessage:gn("nothing-found-message"),nothingFoundMessageDisplayed:gn("nothing-found-message","displayed"),items:gn("items"),overlay:gn("overlay"),overlayHidden:gn("overlay","hidden"),popoverNested:gn(null,"nested"),getPopoverNestedClass:t=>gn(null,`nested-level-${t.toString()}`),popoverInline:gn(null,"inline"),popoverHeader:gn("header")},ha=(t=>(t.NestingLevel="--nesting-level",t.PopoverHeight="--popover-height",t.InlinePopoverWidth="--inline-popover-width",t.TriggerItemLeft="--trigger-item-left",t.TriggerItemTop="--trigger-item-top",t))(ha||{}),oS=ni("ce-popover-item-html"),rS={root:oS(),hidden:oS(null,"hidden")},ts=class extends nc{constructor(e,n){var o,r;super(e),this.nodes={root:z.make("div",rS.root)},this.nodes.root.appendChild(e.element),e.name&&(this.nodes.root.dataset.itemName=e.name),e.hint!==void 0&&((o=n?.hint)==null?void 0:o.enabled)!==!1&&this.addHint(this.nodes.root,{...e.hint,position:((r=n?.hint)==null?void 0:r.position)||"right"})}getElement(){return this.nodes.root}toggleHidden(e){var n;(n=this.nodes.root)==null||n.classList.toggle(rS.hidden,e)}getControls(){let e=this.nodes.root.querySelectorAll(`button, ${z.allInputsSelector}`);return Array.from(e)}},Du=class extends Qi{constructor(e,n={}){super(),this.params=e,this.itemsRenderParams=n,this.listeners=new es,this.messages={nothingFound:"Nothing found",search:"Search"},this.items=this.buildItems(e.items),e.messages&&(this.messages={...this.messages,...e.messages}),this.nodes={},this.nodes.popoverContainer=z.make("div",[xt.popoverContainer]),this.nodes.nothingFoundMessage=z.make("div",[xt.nothingFoundMessage],{textContent:this.messages.nothingFound}),this.nodes.popoverContainer.appendChild(this.nodes.nothingFoundMessage),this.nodes.items=z.make("div",[xt.items]),this.items.forEach(o=>{let r=o.getElement();r!==null&&this.nodes.items.appendChild(r)}),this.nodes.popoverContainer.appendChild(this.nodes.items),this.listeners.on(this.nodes.popoverContainer,"click",o=>this.handleClick(o)),this.nodes.popover=z.make("div",[xt.popover,this.params.class]),this.nodes.popover.appendChild(this.nodes.popoverContainer)}get itemsDefault(){return this.items.filter(e=>e instanceof br)}getElement(){return this.nodes.popover}show(){this.nodes.popover.classList.add(xt.popoverOpened),this.search!==void 0&&this.search.focus()}hide(){this.nodes.popover.classList.remove(xt.popoverOpened),this.nodes.popover.classList.remove(xt.popoverOpenTop),this.itemsDefault.forEach(e=>e.reset()),this.search!==void 0&&this.search.clear(),this.emit(Ho.Closed)}destroy(){var e;this.items.forEach(n=>n.destroy()),this.nodes.popover.remove(),this.listeners.removeAll(),(e=this.search)==null||e.destroy()}activateItemByName(e){let n=this.items.find(o=>o.name===e);this.handleItemClick(n)}buildItems(e){return e.map(n=>{switch(n.type){case tt.Separator:return new Nu;case tt.Html:return new ts(n,this.itemsRenderParams[tt.Html]);default:return new br(n,this.itemsRenderParams[tt.Default])}})}getTargetItem(e){return this.items.filter(n=>n instanceof br||n instanceof ts).find(n=>{let o=n.getElement();return o===null?!1:e.composedPath().includes(o)})}handleItemClick(e){if(!("isDisabled"in e&&e.isDisabled)){if(e.hasChildren){this.showNestedItems(e),"handleClick"in e&&typeof e.handleClick=="function"&&e.handleClick();return}this.itemsDefault.filter(n=>n!==e).forEach(n=>n.reset()),"handleClick"in e&&typeof e.handleClick=="function"&&e.handleClick(),this.toggleItemActivenessIfNeeded(e),e.closeOnActivate&&(this.hide(),this.emit(Ho.ClosedOnActivate))}}handleClick(e){let n=this.getTargetItem(e);n!==void 0&&this.handleItemClick(n)}toggleItemActivenessIfNeeded(e){if(e instanceof br&&(e.toggle===!0&&e.toggleActive(),typeof e.toggle=="string")){let n=this.itemsDefault.filter(o=>o.toggle===e.toggle);if(n.length===1){e.toggleActive();return}n.forEach(o=>{o.toggleActive(o===e)})}}},Ou=(t=>(t.Search="search",t))(Ou||{}),Jg=ni("cdx-search-field"),Xg={wrapper:Jg(),icon:Jg("icon"),input:Jg("input")},Tm=class extends Qi{constructor({items:e,placeholder:n}){super(),this.listeners=new es,this.items=e,this.wrapper=z.make("div",Xg.wrapper);let o=z.make("div",Xg.icon,{innerHTML:x4});this.input=z.make("input",Xg.input,{placeholder:n,tabIndex:-1}),this.wrapper.appendChild(o),this.wrapper.appendChild(this.input),this.listeners.on(this.input,"input",()=>{this.searchQuery=this.input.value,this.emit(Ou.Search,{query:this.searchQuery,items:this.foundItems})})}getElement(){return this.wrapper}focus(){this.input.focus()}clear(){this.input.value="",this.searchQuery="",this.emit(Ou.Search,{query:"",items:this.foundItems})}destroy(){this.listeners.removeAll()}get foundItems(){return this.items.filter(e=>this.checkItem(e))}checkItem(e){var n,o;let r=((n=e.title)==null?void 0:n.toLowerCase())||"",i=(o=this.searchQuery)==null?void 0:o.toLowerCase();return i!==void 0?r.includes(i):!1}},T4=Object.defineProperty,S4=Object.getOwnPropertyDescriptor,k4=(t,e,n,o)=>{for(var r=o>1?void 0:o?S4(e,n):e,i=t.length-1,s;i>=0;i--)(s=t[i])&&(r=(o?s(e,n,r):s(r))||r);return o&&r&&T4(e,n,r),r},NS=class DS extends Du{constructor(e,n){super(e,n),this.nestingLevel=0,this.nestedPopoverTriggerItem=null,this.previouslyHoveredItem=null,this.scopeElement=document.body,this.hide=()=>{var o;super.hide(),this.destroyNestedPopoverIfExists(),(o=this.flipper)==null||o.deactivate(),this.previouslyHoveredItem=null},this.onFlip=()=>{let o=this.itemsDefault.find(r=>r.isFocused);o?.onFocus()},this.onSearch=o=>{var r;let i=o.query==="",s=o.items.length===0;this.items.forEach(l=>{let c=!1;l instanceof br?c=!o.items.includes(l):(l instanceof Nu||l instanceof ts)&&(c=s||!i),l.toggleHidden(c)}),this.toggleNothingFoundMessage(s);let a=o.query===""?this.flippableElements:o.items.map(l=>l.getElement());(r=this.flipper)!=null&&r.isActivated&&(this.flipper.deactivate(),this.flipper.activate(a))},e.nestingLevel!==void 0&&(this.nestingLevel=e.nestingLevel),this.nestingLevel>0&&this.nodes.popover.classList.add(xt.popoverNested),e.scopeElement!==void 0&&(this.scopeElement=e.scopeElement),this.nodes.popoverContainer!==null&&this.listeners.on(this.nodes.popoverContainer,"mouseover",o=>this.handleHover(o)),e.searchable&&this.addSearch(),e.flippable!==!1&&(this.flipper=new ga({items:this.flippableElements,focusedItemClass:ht.focused,allowedKeys:[Ce.TAB,Ce.UP,Ce.DOWN,Ce.ENTER]}),this.flipper.onFlip(this.onFlip))}hasFocus(){return this.flipper===void 0?!1:this.flipper.hasFocus()}get scrollTop(){return this.nodes.items===null?0:this.nodes.items.scrollTop}get offsetTop(){return this.nodes.popoverContainer===null?0:this.nodes.popoverContainer.offsetTop}show(){var e;this.nodes.popover.style.setProperty(ha.PopoverHeight,this.size.height+"px"),this.shouldOpenBottom||this.nodes.popover.classList.add(xt.popoverOpenTop),this.shouldOpenRight||this.nodes.popover.classList.add(xt.popoverOpenLeft),super.show(),(e=this.flipper)==null||e.activate(this.flippableElements)}destroy(){this.hide(),super.destroy()}showNestedItems(e){this.nestedPopover!==null&&this.nestedPopover!==void 0||(this.nestedPopoverTriggerItem=e,this.showNestedPopoverForItem(e))}handleHover(e){let n=this.getTargetItem(e);n!==void 0&&this.previouslyHoveredItem!==n&&(this.destroyNestedPopoverIfExists(),this.previouslyHoveredItem=n,n.hasChildren&&this.showNestedPopoverForItem(n))}setTriggerItemPosition(e,n){let o=n.getElement(),r=(o?o.offsetTop:0)-this.scrollTop,i=this.offsetTop+r;e.style.setProperty(ha.TriggerItemTop,i+"px")}destroyNestedPopoverIfExists(){var e,n;this.nestedPopover===void 0||this.nestedPopover===null||(this.nestedPopover.off(Ho.ClosedOnActivate,this.hide),this.nestedPopover.hide(),this.nestedPopover.destroy(),this.nestedPopover.getElement().remove(),this.nestedPopover=null,(e=this.flipper)==null||e.activate(this.flippableElements),(n=this.nestedPopoverTriggerItem)==null||n.onChildrenClose())}showNestedPopoverForItem(e){var n;this.nestedPopover=new DS({searchable:e.isChildrenSearchable,items:e.children,nestingLevel:this.nestingLevel+1,flippable:e.isChildrenFlippable,messages:this.messages}),e.onChildrenOpen(),this.nestedPopover.on(Ho.ClosedOnActivate,this.hide);let o=this.nestedPopover.getElement();return this.nodes.popover.appendChild(o),this.setTriggerItemPosition(o,e),o.style.setProperty(ha.NestingLevel,this.nestedPopover.nestingLevel.toString()),this.nestedPopover.show(),(n=this.flipper)==null||n.deactivate(),this.nestedPopover}get shouldOpenBottom(){if(this.nodes.popover===void 0||this.nodes.popover===null)return!1;let e=this.nodes.popoverContainer.getBoundingClientRect(),n=this.scopeElement.getBoundingClientRect(),o=this.size.height,r=e.top+o,i=e.top-o,s=Math.min(window.innerHeight,n.bottom);return i<n.top||r<=s}get shouldOpenRight(){if(this.nodes.popover===void 0||this.nodes.popover===null)return!1;let e=this.nodes.popover.getBoundingClientRect(),n=this.scopeElement.getBoundingClientRect(),o=this.size.width,r=e.right+o,i=e.left-o,s=Math.min(window.innerWidth,n.right);return i<n.left||r<=s}get size(){var e;let n={height:0,width:0};if(this.nodes.popover===null)return n;let o=this.nodes.popover.cloneNode(!0);o.style.visibility="hidden",o.style.position="absolute",o.style.top="-1000px",o.classList.add(xt.popoverOpened),(e=o.querySelector("."+xt.popoverNested))==null||e.remove(),document.body.appendChild(o);let r=o.querySelector("."+xt.popoverContainer);return n.height=r.offsetHeight,n.width=r.offsetWidth,o.remove(),n}get flippableElements(){return this.items.map(e=>{if(e instanceof br)return e.getElement();if(e instanceof ts)return e.getControls()}).flat().filter(e=>e!=null)}addSearch(){this.search=new Tm({items:this.itemsDefault,placeholder:this.messages.search}),this.search.on(Ou.Search,this.onSearch);let e=this.search.getElement();e.classList.add(xt.search),this.nodes.popoverContainer.insertBefore(e,this.nodes.popoverContainer.firstChild)}toggleNothingFoundMessage(e){this.nodes.nothingFoundMessage.classList.toggle(xt.nothingFoundMessageDisplayed,e)}};k4([_a],NS.prototype,"size",1);var o_=NS,Sm=class extends o_{constructor(e){let n=!ba();super({...e,class:xt.popoverInline},{[tt.Default]:{wrapperTag:"button",hint:{position:"top",alignment:"center",enabled:n}},[tt.Html]:{hint:{position:"top",alignment:"center",enabled:n}}}),this.items.forEach(o=>{!(o instanceof br)&&!(o instanceof ts)||o.hasChildren&&o.isChildrenOpen&&this.showNestedItems(o)})}get offsetLeft(){return this.nodes.popoverContainer===null?0:this.nodes.popoverContainer.offsetLeft}show(){this.nestingLevel===0&&this.nodes.popover.style.setProperty(ha.InlinePopoverWidth,this.size.width+"px"),super.show()}handleHover(){}setTriggerItemPosition(e,n){let o=n.getElement(),r=o?o.offsetLeft:0,i=this.offsetLeft+r;e.style.setProperty(ha.TriggerItemLeft,i+"px")}showNestedItems(e){if(this.nestedPopoverTriggerItem===e){this.destroyNestedPopoverIfExists(),this.nestedPopoverTriggerItem=null;return}super.showNestedItems(e)}showNestedPopoverForItem(e){let n=super.showNestedPopoverForItem(e);return n.getElement().classList.add(xt.getPopoverNestedClass(n.nestingLevel)),n}handleItemClick(e){var n;e!==this.nestedPopoverTriggerItem&&((n=this.nestedPopoverTriggerItem)==null||n.handleClick(),super.destroyNestedPopoverIfExists()),super.handleItemClick(e)}},OS=class Zl{constructor(){this.scrollPosition=null}lock(){om?this.lockHard():document.body.classList.add(Zl.CSS.scrollLocked)}unlock(){om?this.unlockHard():document.body.classList.remove(Zl.CSS.scrollLocked)}lockHard(){this.scrollPosition=window.pageYOffset,document.documentElement.style.setProperty("--window-scroll-offset",`${this.scrollPosition}px`),document.body.classList.add(Zl.CSS.scrollLockedHard)}unlockHard(){document.body.classList.remove(Zl.CSS.scrollLockedHard),this.scrollPosition!==null&&window.scrollTo(0,this.scrollPosition),this.scrollPosition=null}};OS.CSS={scrollLocked:"ce-scroll-locked",scrollLockedHard:"ce-scroll-locked--hard"};var N4=OS,Zg=ni("ce-popover-header"),Qg={root:Zg(),text:Zg("text"),backButton:Zg("back-button")},km=class{constructor({text:e,onBackButtonClick:n}){this.listeners=new es,this.text=e,this.onBackButtonClick=n,this.nodes={root:z.make("div",[Qg.root]),backButton:z.make("button",[Qg.backButton]),text:z.make("div",[Qg.text])},this.nodes.backButton.innerHTML=p4,this.nodes.root.appendChild(this.nodes.backButton),this.listeners.on(this.nodes.backButton,"click",this.onBackButtonClick),this.nodes.text.innerText=this.text,this.nodes.root.appendChild(this.nodes.text)}getElement(){return this.nodes.root}destroy(){this.nodes.root.remove(),this.listeners.destroy()}},Nm=class{constructor(){this.history=[]}push(e){this.history.push(e)}pop(){return this.history.pop()}get currentTitle(){return this.history.length===0?"":this.history[this.history.length-1].title}get currentItems(){return this.history.length===0?[]:this.history[this.history.length-1].items}reset(){for(;this.history.length>1;)this.pop()}},Iu=class extends Du{constructor(e){super(e,{[tt.Default]:{hint:{enabled:!1}},[tt.Html]:{hint:{enabled:!1}}}),this.scrollLocker=new N4,this.history=new Nm,this.isHidden=!0,this.nodes.overlay=z.make("div",[xt.overlay,xt.overlayHidden]),this.nodes.popover.insertBefore(this.nodes.overlay,this.nodes.popover.firstChild),this.listeners.on(this.nodes.overlay,"click",()=>{this.hide()}),this.history.push({items:e.items})}show(){this.nodes.overlay.classList.remove(xt.overlayHidden),super.show(),this.scrollLocker.lock(),this.isHidden=!1}hide(){this.isHidden||(super.hide(),this.nodes.overlay.classList.add(xt.overlayHidden),this.scrollLocker.unlock(),this.history.reset(),this.isHidden=!0)}destroy(){super.destroy(),this.scrollLocker.unlock()}showNestedItems(e){this.updateItemsAndHeader(e.children,e.title),this.history.push({title:e.title,items:e.children})}updateItemsAndHeader(e,n){if(this.header!==null&&this.header!==void 0&&(this.header.destroy(),this.header=null),n!==void 0){this.header=new km({text:n,onBackButtonClick:()=>{this.history.pop(),this.updateItemsAndHeader(this.history.currentItems,this.history.currentTitle)}});let o=this.header.getElement();o!==null&&this.nodes.popoverContainer.insertBefore(o,this.nodes.popoverContainer.firstChild)}this.items.forEach(o=>{var r;return(r=o.getElement())==null?void 0:r.remove()}),this.items=this.buildItems(e),this.items.forEach(o=>{var r;let i=o.getElement();i!==null&&((r=this.nodes.items)==null||r.appendChild(i))})}},Dm=class extends Ie{constructor(){super(...arguments),this.opened=!1,this.selection=new ge,this.popover=null,this.close=()=>{this.opened&&(this.opened=!1,ge.isAtEditor||this.selection.restore(),this.selection.clearSaved(),!this.Editor.CrossBlockSelection.isCrossBlockSelectionStarted&&this.Editor.BlockManager.currentBlock&&this.Editor.BlockSelection.unselectBlock(this.Editor.BlockManager.currentBlock),this.eventsDispatcher.emit(this.events.closed),this.popover&&(this.popover.off(Ho.Closed,this.onPopoverClose),this.popover.destroy(),this.popover.getElement().remove(),this.popover=null))},this.onPopoverClose=()=>{this.close()}}get events(){return{opened:"block-settings-opened",closed:"block-settings-closed"}}get CSS(){return{settings:"ce-settings"}}get flipper(){var e;if(this.popover!==null)return"flipper"in this.popover?(e=this.popover)==null?void 0:e.flipper:void 0}make(){this.nodes.wrapper=z.make("div",[this.CSS.settings]),this.nodes.wrapper.setAttribute("data-cy","block-tunes"),this.eventsDispatcher.on(tc,this.close)}destroy(){this.removeAllNodes(),this.listeners.destroy(),this.eventsDispatcher.off(tc,this.close)}async open(e=this.Editor.BlockManager.currentBlock){var n;this.opened=!0,this.selection.save(),this.Editor.BlockSelection.selectBlock(e),this.Editor.BlockSelection.clearCache();let{toolTunes:o,commonTunes:r}=e.getTunes();this.eventsDispatcher.emit(this.events.opened);let i=ba()?Iu:o_;this.popover=new i({searchable:!0,items:await this.getTunesItems(e,r,o),scopeElement:this.Editor.API.methods.ui.nodes.redactor,messages:{nothingFound:mn.ui(Gn.ui.popover,"Nothing found"),search:mn.ui(Gn.ui.popover,"Filter")}}),this.popover.on(Ho.Closed,this.onPopoverClose),(n=this.nodes.wrapper)==null||n.append(this.popover.getElement()),this.popover.show()}getElement(){return this.nodes.wrapper}async getTunesItems(e,n,o){let r=[];o!==void 0&&o.length>0&&(r.push(...o),r.push({type:tt.Separator}));let i=Array.from(this.Editor.Tools.blockTools.values()),s=(await vS(e,i)).reduce((a,l)=>(l.toolbox.forEach(c=>{a.push({icon:c.icon,title:mn.t(Gn.toolNames,c.title),name:l.name,closeOnActivate:!0,onActivate:async()=>{let{BlockManager:d,Caret:u,Toolbar:p}=this.Editor,f=await d.convert(e,l.name,c.data);p.close(),u.setToBlock(f,u.positions.END)}})}),a),[]);return s.length>0&&(r.push({icon:kS,name:"convert-to",title:mn.ui(Gn.ui.popover,"Convert to"),children:{searchable:!0,items:s}}),r.push({type:tt.Separator})),r.push(...n),r.map(a=>this.resolveTuneAliases(a))}resolveTuneAliases(e){if(e.type===tt.Separator||e.type===tt.Html)return e;let n=c4(e,{label:"title"});return e.confirmation&&(n.confirmation=this.resolveTuneAliases(e.confirmation)),n}},IS={exports:{}};(function(t,e){(function(n,o){t.exports=o()})(window,function(){return(function(n){var o={};function r(i){if(o[i])return o[i].exports;var s=o[i]={i,l:!1,exports:{}};return n[i].call(s.exports,s,s.exports,r),s.l=!0,s.exports}return r.m=n,r.c=o,r.d=function(i,s,a){r.o(i,s)||Object.defineProperty(i,s,{enumerable:!0,get:a})},r.r=function(i){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(i,"__esModule",{value:!0})},r.t=function(i,s){if(1&s&&(i=r(i)),8&s||4&s&&typeof i=="object"&&i&&i.__esModule)return i;var a=Object.create(null);if(r.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:i}),2&s&&typeof i!="string")for(var l in i)r.d(a,l,(function(c){return i[c]}).bind(null,l));return a},r.n=function(i){var s=i&&i.__esModule?function(){return i.default}:function(){return i};return r.d(s,"a",s),s},r.o=function(i,s){return Object.prototype.hasOwnProperty.call(i,s)},r.p="",r(r.s=0)})([function(n,o,r){function i(l,c){for(var d=0;d<c.length;d++){var u=c[d];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(l,u.key,u)}}function s(l,c,d){return c&&i(l.prototype,c),d&&i(l,d),l}r.r(o);var a=(function(){function l(c){var d=this;(function(u,p){if(!(u instanceof p))throw new TypeError("Cannot call a class as a function")})(this,l),this.commands={},this.keys={},this.name=c.name,this.parseShortcutName(c.name),this.element=c.on,this.callback=c.callback,this.executeShortcut=function(u){d.execute(u)},this.element.addEventListener("keydown",this.executeShortcut,!1)}return s(l,null,[{key:"supportedCommands",get:function(){return{SHIFT:["SHIFT"],CMD:["CMD","CONTROL","COMMAND","WINDOWS","CTRL"],ALT:["ALT","OPTION"]}}},{key:"keyCodes",get:function(){return{0:48,1:49,2:50,3:51,4:52,5:53,6:54,7:55,8:56,9:57,A:65,B:66,C:67,D:68,E:69,F:70,G:71,H:72,I:73,J:74,K:75,L:76,M:77,N:78,O:79,P:80,Q:81,R:82,S:83,T:84,U:85,V:86,W:87,X:88,Y:89,Z:90,BACKSPACE:8,ENTER:13,ESCAPE:27,LEFT:37,UP:38,RIGHT:39,DOWN:40,INSERT:45,DELETE:46,".":190}}}]),s(l,[{key:"parseShortcutName",value:function(c){c=c.split("+");for(var d=0;d<c.length;d++){c[d]=c[d].toUpperCase();var u=!1;for(var p in l.supportedCommands)if(l.supportedCommands[p].includes(c[d])){u=this.commands[p]=!0;break}u||(this.keys[c[d]]=!0)}for(var f in l.supportedCommands)this.commands[f]||(this.commands[f]=!1)}},{key:"execute",value:function(c){var d,u={CMD:c.ctrlKey||c.metaKey,SHIFT:c.shiftKey,ALT:c.altKey},p=!0;for(d in this.commands)this.commands[d]!==u[d]&&(p=!1);var f,h=!0;for(f in this.keys)h=h&&c.keyCode===l.keyCodes[f];p&&h&&this.callback(c)}},{key:"remove",value:function(){this.element.removeEventListener("keydown",this.executeShortcut)}}]),l})();o.default=a}]).default})})(IS);var D4=IS.exports,O4=zu(D4),Om=class{constructor(){this.registeredShortcuts=new Map}add(e){if(this.findShortcut(e.on,e.name))throw Error(`Shortcut ${e.name} is already registered for ${e.on}. Please remove it before add a new handler.`);let n=new O4({name:e.name,on:e.on,callback:e.handler}),o=this.registeredShortcuts.get(e.on)||[];this.registeredShortcuts.set(e.on,[...o,n])}remove(e,n){let o=this.findShortcut(e,n);if(!o)return;o.remove();let r=this.registeredShortcuts.get(e);this.registeredShortcuts.set(e,r.filter(i=>i!==o))}findShortcut(e,n){return(this.registeredShortcuts.get(e)||[]).find(({name:o})=>o===n)}},ma=new Om,I4=Object.defineProperty,M4=Object.getOwnPropertyDescriptor,MS=(t,e,n,o)=>{for(var r=o>1?void 0:o?M4(e,n):e,i=t.length-1,s;i>=0;i--)(s=t[i])&&(r=(o?s(e,n,r):s(r))||r);return o&&r&&I4(e,n,r),r},_u=(t=>(t.Opened="toolbox-opened",t.Closed="toolbox-closed",t.BlockAdded="toolbox-block-added",t))(_u||{}),r_=class AS extends Qi{constructor({api:e,tools:n,i18nLabels:o}){super(),this.opened=!1,this.listeners=new es,this.popover=null,this.handleMobileLayoutToggle=()=>{this.destroyPopover(),this.initPopover()},this.onPopoverClose=()=>{this.opened=!1,this.emit("toolbox-closed")},this.api=e,this.tools=n,this.i18nLabels=o,this.enableShortcuts(),this.nodes={toolbox:z.make("div",AS.CSS.toolbox)},this.initPopover(),this.nodes.toolbox.setAttribute("data-cy","toolbox"),this.api.events.on(tc,this.handleMobileLayoutToggle)}get isEmpty(){return this.toolsToBeDisplayed.length===0}static get CSS(){return{toolbox:"ce-toolbox"}}getElement(){return this.nodes.toolbox}hasFocus(){if(this.popover!==null)return"hasFocus"in this.popover?this.popover.hasFocus():void 0}destroy(){var e;super.destroy(),this.nodes&&this.nodes.toolbox&&this.nodes.toolbox.remove(),this.removeAllShortcuts(),(e=this.popover)==null||e.off(Ho.Closed,this.onPopoverClose),this.listeners.destroy(),this.api.events.off(tc,this.handleMobileLayoutToggle)}toolButtonActivated(e,n){this.insertNewBlock(e,n)}open(){var e;this.isEmpty||((e=this.popover)==null||e.show(),this.opened=!0,this.emit("toolbox-opened"))}close(){var e;(e=this.popover)==null||e.hide(),this.opened=!1,this.emit("toolbox-closed")}toggle(){this.opened?this.close():this.open()}initPopover(){var e;let n=ba()?Iu:o_;this.popover=new n({scopeElement:this.api.ui.nodes.redactor,searchable:!0,messages:{nothingFound:this.i18nLabels.nothingFound,search:this.i18nLabels.filter},items:this.toolboxItemsToBeDisplayed}),this.popover.on(Ho.Closed,this.onPopoverClose),(e=this.nodes.toolbox)==null||e.append(this.popover.getElement())}destroyPopover(){this.popover!==null&&(this.popover.hide(),this.popover.off(Ho.Closed,this.onPopoverClose),this.popover.destroy(),this.popover=null),this.nodes.toolbox!==null&&(this.nodes.toolbox.innerHTML="")}get toolsToBeDisplayed(){let e=[];return this.tools.forEach(n=>{n.toolbox&&e.push(n)}),e}get toolboxItemsToBeDisplayed(){let e=(n,o,r=!0)=>({icon:n.icon,title:mn.t(Gn.toolNames,n.title||Eu(o.name)),name:o.name,onActivate:()=>{this.toolButtonActivated(o.name,n.data)},secondaryLabel:o.shortcut&&r?Qm(o.shortcut):""});return this.toolsToBeDisplayed.reduce((n,o)=>(Array.isArray(o.toolbox)?o.toolbox.forEach((r,i)=>{n.push(e(r,o,i===0))}):o.toolbox!==void 0&&n.push(e(o.toolbox,o)),n),[])}enableShortcuts(){this.toolsToBeDisplayed.forEach(e=>{let n=e.shortcut;n&&this.enableShortcutForTool(e.name,n)})}enableShortcutForTool(e,n){ma.add({name:n,on:this.api.ui.nodes.redactor,handler:async o=>{o.preventDefault();let r=this.api.blocks.getCurrentBlockIndex(),i=this.api.blocks.getBlockByIndex(r);if(i)try{let s=await this.api.blocks.convert(i.id,e);this.api.caret.setToBlock(s,"end");return}catch{}this.insertNewBlock(e)}})}removeAllShortcuts(){this.toolsToBeDisplayed.forEach(e=>{let n=e.shortcut;n&&ma.remove(this.api.ui.nodes.redactor,n)})}async insertNewBlock(e,n){let o=this.api.blocks.getCurrentBlockIndex(),r=this.api.blocks.getBlockByIndex(o);if(!r)return;let i=r.isEmpty?o:o+1,s;if(n){let l=await this.api.blocks.composeBlockData(e);s=Object.assign(l,n)}let a=this.api.blocks.insert(e,s,void 0,i,void 0,r.isEmpty);a.call(_r.APPEND_CALLBACK),this.api.caret.setToBlock(i),this.emit("toolbox-block-added",{block:a}),this.api.toolbar.close()}};MS([_a],r_.prototype,"toolsToBeDisplayed",1);MS([_a],r_.prototype,"toolboxItemsToBeDisplayed",1);var A4=r_,LS="block hovered";async function L4(t,e){let n=navigator.keyboard;if(!n)return e;try{return(await n.getLayoutMap()).get(t)||e}catch(o){return console.error(o),e}}var Im=class extends Ie{constructor({config:e,eventsDispatcher:n}){super({config:e,eventsDispatcher:n}),this.toolboxInstance=null}get CSS(){return{toolbar:"ce-toolbar",content:"ce-toolbar__content",actions:"ce-toolbar__actions",actionsOpened:"ce-toolbar__actions--opened",toolbarOpened:"ce-toolbar--opened",openedToolboxHolderModifier:"codex-editor--toolbox-opened",plusButton:"ce-toolbar__plus",plusButtonShortcut:"ce-toolbar__plus-shortcut",settingsToggler:"ce-toolbar__settings-btn",settingsTogglerHidden:"ce-toolbar__settings-btn--hidden"}}get opened(){return this.nodes.wrapper.classList.contains(this.CSS.toolbarOpened)}get toolbox(){var e;return{opened:(e=this.toolboxInstance)==null?void 0:e.opened,close:()=>{var n;(n=this.toolboxInstance)==null||n.close()},open:()=>{if(this.toolboxInstance===null){Ue("toolbox.open() called before initialization is finished","warn");return}this.Editor.BlockManager.currentBlock=this.hoveredBlock,this.toolboxInstance.open()},toggle:()=>{if(this.toolboxInstance===null){Ue("toolbox.toggle() called before initialization is finished","warn");return}this.toolboxInstance.toggle()},hasFocus:()=>{var n;return(n=this.toolboxInstance)==null?void 0:n.hasFocus()}}}get blockActions(){return{hide:()=>{this.nodes.actions.classList.remove(this.CSS.actionsOpened)},show:()=>{this.nodes.actions.classList.add(this.CSS.actionsOpened)}}}get blockTunesToggler(){return{hide:()=>this.nodes.settingsToggler.classList.add(this.CSS.settingsTogglerHidden),show:()=>this.nodes.settingsToggler.classList.remove(this.CSS.settingsTogglerHidden)}}toggleReadOnly(e){e?(this.destroy(),this.Editor.BlockSettings.destroy(),this.disableModuleBindings()):window.requestIdleCallback(()=>{this.drawUI(),this.enableModuleBindings()},{timeout:2e3})}moveAndOpen(e=this.Editor.BlockManager.currentBlock){if(this.toolboxInstance===null){Ue("Can't open Toolbar since Editor initialization is not finished yet","warn");return}if(this.toolboxInstance.opened&&this.toolboxInstance.close(),this.Editor.BlockSettings.opened&&this.Editor.BlockSettings.close(),!e)return;this.hoveredBlock=e;let n=e.holder,{isMobile:o}=this.Editor.UI,r,i=20,s=e.firstInput,a=n.getBoundingClientRect(),l=s!==void 0?s.getBoundingClientRect():null,c=l!==null?l.top-a.top:null,d=c!==null?c>i:void 0;if(o)r=n.offsetTop+n.offsetHeight;else if(s===void 0||d){let u=parseInt(window.getComputedStyle(e.pluginsContent).paddingTop);r=n.offsetTop+u}else{let u=UH(s),p=parseInt(window.getComputedStyle(this.nodes.plusButton).height,10);r=n.offsetTop+u-p+8+c}this.nodes.wrapper.style.top=`${Math.floor(r)}px`,this.Editor.BlockManager.blocks.length===1&&e.isEmpty?this.blockTunesToggler.hide():this.blockTunesToggler.show(),this.open()}close(){var e,n;this.Editor.ReadOnly.isEnabled||((e=this.nodes.wrapper)==null||e.classList.remove(this.CSS.toolbarOpened),this.blockActions.hide(),(n=this.toolboxInstance)==null||n.close(),this.Editor.BlockSettings.close(),this.reset())}reset(){this.nodes.wrapper.style.top="unset"}open(e=!0){this.nodes.wrapper.classList.add(this.CSS.toolbarOpened),e?this.blockActions.show():this.blockActions.hide()}async make(){this.nodes.wrapper=z.make("div",this.CSS.toolbar),["content","actions"].forEach(i=>{this.nodes[i]=z.make("div",this.CSS[i])}),z.append(this.nodes.wrapper,this.nodes.content),z.append(this.nodes.content,this.nodes.actions),this.nodes.plusButton=z.make("div",this.CSS.plusButton,{innerHTML:y4}),z.append(this.nodes.actions,this.nodes.plusButton),this.readOnlyMutableListeners.on(this.nodes.plusButton,"click",()=>{Su(!0),this.plusButtonClicked()},!1);let e=z.make("div");e.appendChild(document.createTextNode(mn.ui(Gn.ui.toolbar.toolbox,"Add"))),e.appendChild(z.make("div",this.CSS.plusButtonShortcut,{textContent:"/"})),ku(this.nodes.plusButton,e,{hidingDelay:400}),this.nodes.settingsToggler=z.make("span",this.CSS.settingsToggler,{innerHTML:b4}),z.append(this.nodes.actions,this.nodes.settingsToggler);let n=z.make("div"),o=z.text(mn.ui(Gn.ui.blockTunes.toggler,"Click to tune")),r=await L4("Slash","/");n.appendChild(o),n.appendChild(z.make("div",this.CSS.plusButtonShortcut,{textContent:Qm(`CMD + ${r}`)})),ku(this.nodes.settingsToggler,n,{hidingDelay:400}),z.append(this.nodes.actions,this.makeToolbox()),z.append(this.nodes.actions,this.Editor.BlockSettings.getElement()),z.append(this.Editor.UI.nodes.wrapper,this.nodes.wrapper)}makeToolbox(){return this.toolboxInstance=new A4({api:this.Editor.API.methods,tools:this.Editor.Tools.blockTools,i18nLabels:{filter:mn.ui(Gn.ui.popover,"Filter"),nothingFound:mn.ui(Gn.ui.popover,"Nothing found")}}),this.toolboxInstance.on(_u.Opened,()=>{this.Editor.UI.nodes.wrapper.classList.add(this.CSS.openedToolboxHolderModifier)}),this.toolboxInstance.on(_u.Closed,()=>{this.Editor.UI.nodes.wrapper.classList.remove(this.CSS.openedToolboxHolderModifier)}),this.toolboxInstance.on(_u.BlockAdded,({block:e})=>{let{BlockManager:n,Caret:o}=this.Editor,r=n.getBlockById(e.id);r.inputs.length===0&&(r===n.lastBlock?(n.insertAtEnd(),o.setToBlock(n.lastBlock)):o.setToBlock(n.nextBlock))}),this.toolboxInstance.getElement()}plusButtonClicked(){var e;this.Editor.BlockManager.currentBlock=this.hoveredBlock,(e=this.toolboxInstance)==null||e.toggle()}enableModuleBindings(){this.readOnlyMutableListeners.on(this.nodes.settingsToggler,"mousedown",e=>{var n;e.stopPropagation(),this.settingsTogglerClicked(),(n=this.toolboxInstance)!=null&&n.opened&&this.toolboxInstance.close(),Su(!0)},!0),ba()||this.eventsDispatcher.on(LS,e=>{var n;this.Editor.BlockSettings.opened||(n=this.toolboxInstance)!=null&&n.opened||this.moveAndOpen(e.block)})}disableModuleBindings(){this.readOnlyMutableListeners.clearAll()}settingsTogglerClicked(){this.Editor.BlockManager.currentBlock=this.hoveredBlock,this.Editor.BlockSettings.opened?this.Editor.BlockSettings.close():this.Editor.BlockSettings.open(this.hoveredBlock)}drawUI(){this.Editor.BlockSettings.make(),this.make()}destroy(){this.removeAllNodes(),this.toolboxInstance&&this.toolboxInstance.destroy()}},Xi=(t=>(t[t.Block=0]="Block",t[t.Inline=1]="Inline",t[t.Tune=2]="Tune",t))(Xi||{}),bu=(t=>(t.Shortcut="shortcut",t.Toolbox="toolbox",t.EnabledInlineTools="inlineToolbar",t.EnabledBlockTunes="tunes",t.Config="config",t))(bu||{}),RS=(t=>(t.Shortcut="shortcut",t.SanitizeConfig="sanitize",t))(RS||{}),fa=(t=>(t.IsEnabledLineBreaks="enableLineBreaks",t.Toolbox="toolbox",t.ConversionConfig="conversionConfig",t.IsReadOnlySupported="isReadOnlySupported",t.PasteConfig="pasteConfig",t))(fa||{}),Mu=(t=>(t.IsInline="isInline",t.Title="title",t.IsReadOnlySupported="isReadOnlySupported",t))(Mu||{}),Mm=(t=>(t.IsTune="isTune",t))(Mm||{}),oc=class{constructor({name:e,constructable:n,config:o,api:r,isDefault:i,isInternal:s=!1,defaultPlaceholder:a}){this.api=r,this.name=e,this.constructable=n,this.config=o,this.isDefault=i,this.isInternal=s,this.defaultPlaceholder=a}get settings(){let e=this.config.config||{};return this.isDefault&&!("placeholder"in e)&&this.defaultPlaceholder&&(e.placeholder=this.defaultPlaceholder),e}reset(){if(lt(this.constructable.reset))return this.constructable.reset()}prepare(){if(lt(this.constructable.prepare))return this.constructable.prepare({toolName:this.name,config:this.settings})}get shortcut(){let e=this.constructable.shortcut;return this.config.shortcut||e}get sanitizeConfig(){return this.constructable.sanitize||{}}isInline(){return this.type===Xi.Inline}isBlock(){return this.type===Xi.Block}isTune(){return this.type===Xi.Tune}},Am=class extends Ie{constructor({config:e,eventsDispatcher:n}){super({config:e,eventsDispatcher:n}),this.CSS={inlineToolbar:"ce-inline-toolbar"},this.opened=!1,this.popover=null,this.toolbarVerticalMargin=ba()?20:6,this.tools=new Map,window.requestIdleCallback(()=>{this.make()},{timeout:2e3})}async tryToShow(e=!1){e&&this.close(),this.allowedToShow()&&(await this.open(),this.Editor.Toolbar.close())}close(){var e,n;if(this.opened){for(let[o,r]of this.tools){let i=this.getToolShortcut(o.name);i!==void 0&&ma.remove(this.Editor.UI.nodes.redactor,i),lt(r.clear)&&r.clear()}this.tools=new Map,this.reset(),this.opened=!1,(e=this.popover)==null||e.hide(),(n=this.popover)==null||n.destroy(),this.popover=null}}containsNode(e){return this.nodes.wrapper===void 0?!1:this.nodes.wrapper.contains(e)}destroy(){var e;this.removeAllNodes(),(e=this.popover)==null||e.destroy(),this.popover=null}make(){this.nodes.wrapper=z.make("div",[this.CSS.inlineToolbar,...this.isRtl?[this.Editor.UI.CSS.editorRtlFix]:[]]),this.nodes.wrapper.setAttribute("data-cy","inline-toolbar"),z.append(this.Editor.UI.nodes.wrapper,this.nodes.wrapper)}async open(){var e;if(this.opened)return;this.opened=!0,this.popover!==null&&this.popover.destroy(),this.createToolsInstances();let n=await this.getPopoverItems();this.popover=new Sm({items:n,scopeElement:this.Editor.API.methods.ui.nodes.redactor,messages:{nothingFound:mn.ui(Gn.ui.popover,"Nothing found"),search:mn.ui(Gn.ui.popover,"Filter")}}),this.move(this.popover.size.width),(e=this.nodes.wrapper)==null||e.append(this.popover.getElement()),this.popover.show()}move(e){let n=ge.rect,o=this.Editor.UI.nodes.wrapper.getBoundingClientRect(),r={x:n.x-o.x,y:n.y+n.height-o.top+this.toolbarVerticalMargin};r.x+e+o.x>this.Editor.UI.contentRect.right&&(r.x=this.Editor.UI.contentRect.right-e-o.x),this.nodes.wrapper.style.left=Math.floor(r.x)+"px",this.nodes.wrapper.style.top=Math.floor(r.y)+"px"}reset(){this.nodes.wrapper.style.left="0",this.nodes.wrapper.style.top="0"}allowedToShow(){let e=["IMG","INPUT"],n=ge.get(),o=ge.text;if(!n||!n.anchorNode||n.isCollapsed||o.length<1)return!1;let r=z.isElement(n.anchorNode)?n.anchorNode:n.anchorNode.parentElement;if(r===null||n!==null&&e.includes(r.tagName))return!1;let i=this.Editor.BlockManager.getBlock(n.anchorNode);return!i||this.getTools().some(s=>i.tool.inlineTools.has(s.name))===!1?!1:r.closest("[contenteditable]")!==null}getTools(){let e=this.Editor.BlockManager.currentBlock;return e?Array.from(e.tool.inlineTools.values()).filter(n=>!(this.Editor.ReadOnly.isEnabled&&n.isReadOnlySupported!==!0)):[]}createToolsInstances(){this.tools=new Map,this.getTools().forEach(e=>{let n=e.create();this.tools.set(e,n)})}async getPopoverItems(){let e=[],n=0;for(let[o,r]of this.tools){let i=await r.render(),s=this.getToolShortcut(o.name);if(s!==void 0)try{this.enableShortcuts(o.name,s)}catch{}let a=s!==void 0?Qm(s):void 0,l=mn.t(Gn.toolNames,o.title||Eu(o.name));[i].flat().forEach(c=>{var d,u;let p={name:o.name,onActivate:()=>{this.toolClicked(r)},hint:{title:l,description:a}};if(z.isElement(c)){let f={...p,element:c,type:tt.Html};if(lt(r.renderActions)){let h=r.renderActions();f.children={isOpen:(d=r.checkState)==null?void 0:d.call(r,ge.get()),isFlippable:!1,items:[{type:tt.Html,element:h}]}}else(u=r.checkState)==null||u.call(r,ge.get());e.push(f)}else if(c.type===tt.Html)e.push({...p,...c,type:tt.Html});else if(c.type===tt.Separator)e.push({type:tt.Separator});else{let f={...p,...c,type:tt.Default};"children"in f&&n!==0&&e.push({type:tt.Separator}),e.push(f),"children"in f&&n<this.tools.size-1&&e.push({type:tt.Separator})}}),n++}return e}getToolShortcut(e){let{Tools:n}=this.Editor,o=n.inlineTools.get(e),r=n.internal.inlineTools;return Array.from(r.keys()).includes(e)?this.inlineTools[e][RS.Shortcut]:o?.shortcut}enableShortcuts(e,n){ma.add({name:n,handler:o=>{var r;let{currentBlock:i}=this.Editor.BlockManager;i&&i.tool.enabledInlineTools&&(o.preventDefault(),(r=this.popover)==null||r.activateItemByName(e))},on:document})}toolClicked(e){var n;let o=ge.range;(n=e.surround)==null||n.call(e,o),this.checkToolsState()}checkToolsState(){var e;(e=this.tools)==null||e.forEach(n=>{var o;(o=n.checkState)==null||o.call(n,ge.get())})}get inlineTools(){let e={};return Array.from(this.Editor.Tools.inlineTools.entries()).forEach(([n,o])=>{e[n]=o.create()}),e}};function PS(){let t=window.getSelection();if(t===null)return[null,0];let e=t.focusNode,n=t.focusOffset;return e===null?[null,0]:(e.nodeType!==Node.TEXT_NODE&&e.childNodes.length>0&&(e.childNodes[n]?(e=e.childNodes[n],n=0):(e=e.childNodes[n-1],n=e.textContent.length)),[e,n])}function FS(t,e,n,o){let r=document.createRange();o==="left"?(r.setStart(t,0),r.setEnd(e,n)):(r.setStart(e,n),r.setEnd(t,t.childNodes.length));let i=r.cloneContents(),s=document.createElement("div");s.appendChild(i);let a=s.textContent||"";return KH(a)}function yu(t){let e=z.getDeepestNode(t);if(e===null||z.isEmpty(t))return!0;if(z.isNativeInput(e))return e.selectionEnd===0;if(z.isEmpty(t))return!0;let[n,o]=PS();return n===null?!1:FS(t,n,o,"left")}function xu(t){let e=z.getDeepestNode(t,!0);if(e===null)return!0;if(z.isNativeInput(e))return e.selectionEnd===e.value.length;let[n,o]=PS();return n===null?!1:FS(t,n,o,"right")}var BS={},i_={},Hu={},ns={},s_={},a_={};Object.defineProperty(a_,"__esModule",{value:!0});a_.allInputsSelector=R4;function R4(){var t=["text","password","email","number","search","tel","url"];return"[contenteditable=true], textarea, input:not([type]), "+t.map(function(e){return'input[type="'.concat(e,'"]')}).join(", ")}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.allInputsSelector=void 0;var e=a_;Object.defineProperty(t,"allInputsSelector",{enumerable:!0,get:function(){return e.allInputsSelector}})})(s_);var os={},l_={};Object.defineProperty(l_,"__esModule",{value:!0});l_.isNativeInput=P4;function P4(t){var e=["INPUT","TEXTAREA"];return t&&t.tagName?e.includes(t.tagName):!1}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isNativeInput=void 0;var e=l_;Object.defineProperty(t,"isNativeInput",{enumerable:!0,get:function(){return e.isNativeInput}})})(os);var $S={},c_={};Object.defineProperty(c_,"__esModule",{value:!0});c_.append=F4;function F4(t,e){Array.isArray(e)?e.forEach(function(n){t.appendChild(n)}):t.appendChild(e)}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.append=void 0;var e=c_;Object.defineProperty(t,"append",{enumerable:!0,get:function(){return e.append}})})($S);var d_={},u_={};Object.defineProperty(u_,"__esModule",{value:!0});u_.blockElements=B4;function B4(){return["address","article","aside","blockquote","canvas","div","dl","dt","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","li","main","nav","noscript","ol","output","p","pre","ruby","section","table","tbody","thead","tr","tfoot","ul","video"]}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.blockElements=void 0;var e=u_;Object.defineProperty(t,"blockElements",{enumerable:!0,get:function(){return e.blockElements}})})(d_);var zS={},p_={};Object.defineProperty(p_,"__esModule",{value:!0});p_.calculateBaseline=$4;function $4(t){var e=window.getComputedStyle(t),n=parseFloat(e.fontSize),o=parseFloat(e.lineHeight)||n*1.2,r=parseFloat(e.paddingTop),i=parseFloat(e.borderTopWidth),s=parseFloat(e.marginTop),a=n*.8,l=(o-n)/2,c=s+i+r+l+a;return c}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.calculateBaseline=void 0;var e=p_;Object.defineProperty(t,"calculateBaseline",{enumerable:!0,get:function(){return e.calculateBaseline}})})(zS);var HS={},f_={},h_={},g_={};Object.defineProperty(g_,"__esModule",{value:!0});g_.isContentEditable=z4;function z4(t){return t.contentEditable==="true"}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isContentEditable=void 0;var e=g_;Object.defineProperty(t,"isContentEditable",{enumerable:!0,get:function(){return e.isContentEditable}})})(h_);Object.defineProperty(f_,"__esModule",{value:!0});f_.canSetCaret=U4;var H4=os,K4=h_;function U4(t){var e=!0;if((0,H4.isNativeInput)(t))switch(t.type){case"file":case"checkbox":case"radio":case"hidden":case"submit":case"button":case"image":case"reset":e=!1;break}else e=(0,K4.isContentEditable)(t);return e}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.canSetCaret=void 0;var e=f_;Object.defineProperty(t,"canSetCaret",{enumerable:!0,get:function(){return e.canSetCaret}})})(HS);var Ku={},m_={};function j4(t,e,n){let o=n.value!==void 0?"value":"get",r=n[o],i=`#${e}Cache`;if(n[o]=function(...s){return this[i]===void 0&&(this[i]=r.apply(this,s)),this[i]},o==="get"&&n.set){let s=n.set;n.set=function(a){delete t[i],s.apply(this,a)}}return n}function KS(){let t={win:!1,mac:!1,x11:!1,linux:!1},e=Object.keys(t).find(n=>window.navigator.appVersion.toLowerCase().indexOf(n)!==-1);return e!==void 0&&(t[e]=!0),t}function __(t){return t!=null&&t!==""&&(typeof t!="object"||Object.keys(t).length>0)}function V4(t){return!__(t)}var W4=()=>typeof window<"u"&&window.navigator!==null&&__(window.navigator.platform)&&(/iP(ad|hone|od)/.test(window.navigator.platform)||window.navigator.platform==="MacIntel"&&window.navigator.maxTouchPoints>1);function G4(t){let e=KS();return t=t.replace(/shift/gi,"\u21E7").replace(/backspace/gi,"\u232B").replace(/enter/gi,"\u23CE").replace(/up/gi,"\u2191").replace(/left/gi,"\u2192").replace(/down/gi,"\u2193").replace(/right/gi,"\u2190").replace(/escape/gi,"\u238B").replace(/insert/gi,"Ins").replace(/delete/gi,"\u2421").replace(/\+/gi,"+"),e.mac?t=t.replace(/ctrl|cmd/gi,"\u2318").replace(/alt/gi,"\u2325"):t=t.replace(/cmd/gi,"Ctrl").replace(/windows/gi,"WIN"),t}function Y4(t){return t[0].toUpperCase()+t.slice(1)}function q4(t){let e=document.createElement("div");e.style.position="absolute",e.style.left="-999px",e.style.bottom="-999px",e.innerHTML=t,document.body.appendChild(e);let n=window.getSelection(),o=document.createRange();if(o.selectNode(e),n===null)throw new Error("Cannot copy text to clipboard");n.removeAllRanges(),n.addRange(o),document.execCommand("copy"),document.body.removeChild(e)}function J4(t,e,n){let o;return(...r)=>{let i=this,s=()=>{o=void 0,n!==!0&&t.apply(i,r)},a=n===!0&&o!==void 0;window.clearTimeout(o),o=window.setTimeout(s,e),a&&t.apply(i,r)}}function ti(t){return Object.prototype.toString.call(t).match(/\s([a-zA-Z]+)/)[1].toLowerCase()}function X4(t){return ti(t)==="boolean"}function US(t){return ti(t)==="function"||ti(t)==="asyncfunction"}function Z4(t){return US(t)&&/^\s*class\s+/.test(t.toString())}function Q4(t){return ti(t)==="number"}function vu(t){return ti(t)==="object"}function e5(t){return Promise.resolve(t)===t}function t5(t){return ti(t)==="string"}function n5(t){return ti(t)==="undefined"}function Lm(t,...e){if(!e.length)return t;let n=e.shift();if(vu(t)&&vu(n))for(let o in n)vu(n[o])?(t[o]===void 0&&Object.assign(t,{[o]:{}}),Lm(t[o],n[o])):Object.assign(t,{[o]:n[o]});return Lm(t,...e)}function o5(t,e,n){let o=`\xAB${e}\xBB is deprecated and will be removed in the next major release. Please use the \xAB${n}\xBB instead.`;t&&console.warn(o)}function r5(t){try{return new URL(t).href}catch{}return t.substring(0,2)==="//"?window.location.protocol+t:window.location.origin+t}function i5(t){return t>47&&t<58||t===32||t===13||t===229||t>64&&t<91||t>95&&t<112||t>185&&t<193||t>218&&t<223}var s5={BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,LEFT:37,UP:38,DOWN:40,RIGHT:39,DELETE:46,META:91,SLASH:191},a5={LEFT:0,WHEEL:1,RIGHT:2,BACKWARD:3,FORWARD:4},l5=class{constructor(){this.completed=Promise.resolve()}add(t){return new Promise((e,n)=>{this.completed=this.completed.then(t).then(e).catch(n)})}};function c5(t,e,n=void 0){let o,r,i,s=null,a=0;n||(n={});let l=function(){a=n.leading===!1?0:Date.now(),s=null,i=t.apply(o,r),s===null&&(o=r=null)};return function(){let c=Date.now();!a&&n.leading===!1&&(a=c);let d=e-(c-a);return o=this,r=arguments,d<=0||d>e?(s&&(clearTimeout(s),s=null),a=c,i=t.apply(o,r),s===null&&(o=r=null)):!s&&n.trailing!==!1&&(s=setTimeout(l,d)),i}}var d5=Object.freeze(Object.defineProperty({__proto__:null,PromiseQueue:l5,beautifyShortcut:G4,cacheable:j4,capitalize:Y4,copyTextToClipboard:q4,debounce:J4,deepMerge:Lm,deprecationAssert:o5,getUserOS:KS,getValidUrl:r5,isBoolean:X4,isClass:Z4,isEmpty:V4,isFunction:US,isIosDevice:W4,isNumber:Q4,isObject:vu,isPrintableKey:i5,isPromise:e5,isString:t5,isUndefined:n5,keyCodes:s5,mouseButtons:a5,notEmpty:__,throttle:c5,typeOf:ti},Symbol.toStringTag,{value:"Module"})),b_=NH(d5);Object.defineProperty(m_,"__esModule",{value:!0});m_.containsOnlyInlineElements=f5;var u5=b_,p5=d_;function f5(t){var e;(0,u5.isString)(t)?(e=document.createElement("div"),e.innerHTML=t):e=t;var n=function(o){return!(0,p5.blockElements)().includes(o.tagName.toLowerCase())&&Array.from(o.children).every(n)};return Array.from(e.children).every(n)}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.containsOnlyInlineElements=void 0;var e=m_;Object.defineProperty(t,"containsOnlyInlineElements",{enumerable:!0,get:function(){return e.containsOnlyInlineElements}})})(Ku);var jS={},y_={},Uu={},x_={};Object.defineProperty(x_,"__esModule",{value:!0});x_.make=h5;function h5(t,e,n){var o;e===void 0&&(e=null),n===void 0&&(n={});var r=document.createElement(t);if(Array.isArray(e)){var i=e.filter(function(a){return a!==void 0});(o=r.classList).add.apply(o,i)}else e!==null&&r.classList.add(e);for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(r[s]=n[s]);return r}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.make=void 0;var e=x_;Object.defineProperty(t,"make",{enumerable:!0,get:function(){return e.make}})})(Uu);Object.defineProperty(y_,"__esModule",{value:!0});y_.fragmentToString=m5;var g5=Uu;function m5(t){var e=(0,g5.make)("div");return e.appendChild(t),e.innerHTML}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.fragmentToString=void 0;var e=y_;Object.defineProperty(t,"fragmentToString",{enumerable:!0,get:function(){return e.fragmentToString}})})(jS);var VS={},v_={};Object.defineProperty(v_,"__esModule",{value:!0});v_.getContentLength=b5;var _5=os;function b5(t){var e,n;return(0,_5.isNativeInput)(t)?t.value.length:t.nodeType===Node.TEXT_NODE?t.length:(n=(e=t.textContent)===null||e===void 0?void 0:e.length)!==null&&n!==void 0?n:0}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getContentLength=void 0;var e=v_;Object.defineProperty(t,"getContentLength",{enumerable:!0,get:function(){return e.getContentLength}})})(VS);var C_={},E_={},iS=ec&&ec.__spreadArray||function(t,e,n){if(n||arguments.length===2)for(var o=0,r=e.length,i;o<r;o++)(i||!(o in e))&&(i||(i=Array.prototype.slice.call(e,0,o)),i[o]=e[o]);return t.concat(i||Array.prototype.slice.call(e))};Object.defineProperty(E_,"__esModule",{value:!0});E_.getDeepestBlockElements=WS;var y5=Ku;function WS(t){return(0,y5.containsOnlyInlineElements)(t)?[t]:Array.from(t.children).reduce(function(e,n){return iS(iS([],e,!0),WS(n),!0)},[])}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getDeepestBlockElements=void 0;var e=E_;Object.defineProperty(t,"getDeepestBlockElements",{enumerable:!0,get:function(){return e.getDeepestBlockElements}})})(C_);var GS={},w_={},ju={},T_={};Object.defineProperty(T_,"__esModule",{value:!0});T_.isLineBreakTag=x5;function x5(t){return["BR","WBR"].includes(t.tagName)}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isLineBreakTag=void 0;var e=T_;Object.defineProperty(t,"isLineBreakTag",{enumerable:!0,get:function(){return e.isLineBreakTag}})})(ju);var Vu={},S_={};Object.defineProperty(S_,"__esModule",{value:!0});S_.isSingleTag=v5;function v5(t){return["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"].includes(t.tagName)}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isSingleTag=void 0;var e=S_;Object.defineProperty(t,"isSingleTag",{enumerable:!0,get:function(){return e.isSingleTag}})})(Vu);Object.defineProperty(w_,"__esModule",{value:!0});w_.getDeepestNode=YS;var C5=os,E5=ju,w5=Vu;function YS(t,e){e===void 0&&(e=!1);var n=e?"lastChild":"firstChild",o=e?"previousSibling":"nextSibling";if(t.nodeType===Node.ELEMENT_NODE&&t[n]){var r=t[n];if((0,w5.isSingleTag)(r)&&!(0,C5.isNativeInput)(r)&&!(0,E5.isLineBreakTag)(r))if(r[o])r=r[o];else if(r.parentNode!==null&&r.parentNode[o])r=r.parentNode[o];else return r.parentNode;return YS(r,e)}return t}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getDeepestNode=void 0;var e=w_;Object.defineProperty(t,"getDeepestNode",{enumerable:!0,get:function(){return e.getDeepestNode}})})(GS);var qS={},k_={},gu=ec&&ec.__spreadArray||function(t,e,n){if(n||arguments.length===2)for(var o=0,r=e.length,i;o<r;o++)(i||!(o in e))&&(i||(i=Array.prototype.slice.call(e,0,o)),i[o]=e[o]);return t.concat(i||Array.prototype.slice.call(e))};Object.defineProperty(k_,"__esModule",{value:!0});k_.findAllInputs=D5;var T5=Ku,S5=C_,k5=s_,N5=os;function D5(t){return Array.from(t.querySelectorAll((0,k5.allInputsSelector)())).reduce(function(e,n){return(0,N5.isNativeInput)(n)||(0,T5.containsOnlyInlineElements)(n)?gu(gu([],e,!0),[n],!1):gu(gu([],e,!0),(0,S5.getDeepestBlockElements)(n),!0)},[])}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.findAllInputs=void 0;var e=k_;Object.defineProperty(t,"findAllInputs",{enumerable:!0,get:function(){return e.findAllInputs}})})(qS);var JS={},N_={};Object.defineProperty(N_,"__esModule",{value:!0});N_.isCollapsedWhitespaces=O5;function O5(t){return!/[^\t\n\r ]/.test(t)}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isCollapsedWhitespaces=void 0;var e=N_;Object.defineProperty(t,"isCollapsedWhitespaces",{enumerable:!0,get:function(){return e.isCollapsedWhitespaces}})})(JS);var D_={},O_={};Object.defineProperty(O_,"__esModule",{value:!0});O_.isElement=M5;var I5=b_;function M5(t){return(0,I5.isNumber)(t)?!1:!!t&&!!t.nodeType&&t.nodeType===Node.ELEMENT_NODE}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isElement=void 0;var e=O_;Object.defineProperty(t,"isElement",{enumerable:!0,get:function(){return e.isElement}})})(D_);var XS={},I_={},M_={},A_={};Object.defineProperty(A_,"__esModule",{value:!0});A_.isLeaf=A5;function A5(t){return t===null?!1:t.childNodes.length===0}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isLeaf=void 0;var e=A_;Object.defineProperty(t,"isLeaf",{enumerable:!0,get:function(){return e.isLeaf}})})(M_);var L_={},R_={};Object.defineProperty(R_,"__esModule",{value:!0});R_.isNodeEmpty=B5;var L5=ju,R5=D_,P5=os,F5=Vu;function B5(t,e){var n="";return(0,F5.isSingleTag)(t)&&!(0,L5.isLineBreakTag)(t)?!1:((0,R5.isElement)(t)&&(0,P5.isNativeInput)(t)?n=t.value:t.textContent!==null&&(n=t.textContent.replace("\u200B","")),e!==void 0&&(n=n.replace(new RegExp(e,"g"),"")),n.trim().length===0)}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isNodeEmpty=void 0;var e=R_;Object.defineProperty(t,"isNodeEmpty",{enumerable:!0,get:function(){return e.isNodeEmpty}})})(L_);Object.defineProperty(I_,"__esModule",{value:!0});I_.isEmpty=H5;var $5=M_,z5=L_;function H5(t,e){t.normalize();for(var n=[t];n.length>0;){var o=n.shift();if(o){if(t=o,(0,$5.isLeaf)(t)&&!(0,z5.isNodeEmpty)(t,e))return!1;n.push.apply(n,Array.from(t.childNodes))}}return!0}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isEmpty=void 0;var e=I_;Object.defineProperty(t,"isEmpty",{enumerable:!0,get:function(){return e.isEmpty}})})(XS);var ZS={},P_={};Object.defineProperty(P_,"__esModule",{value:!0});P_.isFragment=U5;var K5=b_;function U5(t){return(0,K5.isNumber)(t)?!1:!!t&&!!t.nodeType&&t.nodeType===Node.DOCUMENT_FRAGMENT_NODE}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isFragment=void 0;var e=P_;Object.defineProperty(t,"isFragment",{enumerable:!0,get:function(){return e.isFragment}})})(ZS);var QS={},F_={};Object.defineProperty(F_,"__esModule",{value:!0});F_.isHTMLString=V5;var j5=Uu;function V5(t){var e=(0,j5.make)("div");return e.innerHTML=t,e.childElementCount>0}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isHTMLString=void 0;var e=F_;Object.defineProperty(t,"isHTMLString",{enumerable:!0,get:function(){return e.isHTMLString}})})(QS);var ek={},B_={};Object.defineProperty(B_,"__esModule",{value:!0});B_.offset=W5;function W5(t){var e=t.getBoundingClientRect(),n=window.pageXOffset||document.documentElement.scrollLeft,o=window.pageYOffset||document.documentElement.scrollTop,r=e.top+o,i=e.left+n;return{top:r,left:i,bottom:r+e.height,right:i+e.width}}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.offset=void 0;var e=B_;Object.defineProperty(t,"offset",{enumerable:!0,get:function(){return e.offset}})})(ek);var tk={},$_={};Object.defineProperty($_,"__esModule",{value:!0});$_.prepend=G5;function G5(t,e){Array.isArray(e)?(e=e.reverse(),e.forEach(function(n){return t.prepend(n)})):t.prepend(e)}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.prepend=void 0;var e=$_;Object.defineProperty(t,"prepend",{enumerable:!0,get:function(){return e.prepend}})})(tk);(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.prepend=t.offset=t.make=t.isLineBreakTag=t.isSingleTag=t.isNodeEmpty=t.isLeaf=t.isHTMLString=t.isFragment=t.isEmpty=t.isElement=t.isContentEditable=t.isCollapsedWhitespaces=t.findAllInputs=t.isNativeInput=t.allInputsSelector=t.getDeepestNode=t.getDeepestBlockElements=t.getContentLength=t.fragmentToString=t.containsOnlyInlineElements=t.canSetCaret=t.calculateBaseline=t.blockElements=t.append=void 0;var e=s_;Object.defineProperty(t,"allInputsSelector",{enumerable:!0,get:function(){return e.allInputsSelector}});var n=os;Object.defineProperty(t,"isNativeInput",{enumerable:!0,get:function(){return n.isNativeInput}});var o=$S;Object.defineProperty(t,"append",{enumerable:!0,get:function(){return o.append}});var r=d_;Object.defineProperty(t,"blockElements",{enumerable:!0,get:function(){return r.blockElements}});var i=zS;Object.defineProperty(t,"calculateBaseline",{enumerable:!0,get:function(){return i.calculateBaseline}});var s=HS;Object.defineProperty(t,"canSetCaret",{enumerable:!0,get:function(){return s.canSetCaret}});var a=Ku;Object.defineProperty(t,"containsOnlyInlineElements",{enumerable:!0,get:function(){return a.containsOnlyInlineElements}});var l=jS;Object.defineProperty(t,"fragmentToString",{enumerable:!0,get:function(){return l.fragmentToString}});var c=VS;Object.defineProperty(t,"getContentLength",{enumerable:!0,get:function(){return c.getContentLength}});var d=C_;Object.defineProperty(t,"getDeepestBlockElements",{enumerable:!0,get:function(){return d.getDeepestBlockElements}});var u=GS;Object.defineProperty(t,"getDeepestNode",{enumerable:!0,get:function(){return u.getDeepestNode}});var p=qS;Object.defineProperty(t,"findAllInputs",{enumerable:!0,get:function(){return p.findAllInputs}});var f=JS;Object.defineProperty(t,"isCollapsedWhitespaces",{enumerable:!0,get:function(){return f.isCollapsedWhitespaces}});var h=h_;Object.defineProperty(t,"isContentEditable",{enumerable:!0,get:function(){return h.isContentEditable}});var m=D_;Object.defineProperty(t,"isElement",{enumerable:!0,get:function(){return m.isElement}});var _=XS;Object.defineProperty(t,"isEmpty",{enumerable:!0,get:function(){return _.isEmpty}});var b=ZS;Object.defineProperty(t,"isFragment",{enumerable:!0,get:function(){return b.isFragment}});var y=QS;Object.defineProperty(t,"isHTMLString",{enumerable:!0,get:function(){return y.isHTMLString}});var x=M_;Object.defineProperty(t,"isLeaf",{enumerable:!0,get:function(){return x.isLeaf}});var v=L_;Object.defineProperty(t,"isNodeEmpty",{enumerable:!0,get:function(){return v.isNodeEmpty}});var E=ju;Object.defineProperty(t,"isLineBreakTag",{enumerable:!0,get:function(){return E.isLineBreakTag}});var C=Vu;Object.defineProperty(t,"isSingleTag",{enumerable:!0,get:function(){return C.isSingleTag}});var k=Uu;Object.defineProperty(t,"make",{enumerable:!0,get:function(){return k.make}});var T=ek;Object.defineProperty(t,"offset",{enumerable:!0,get:function(){return T.offset}});var w=tk;Object.defineProperty(t,"prepend",{enumerable:!0,get:function(){return w.prepend}})})(ns);var Wu={};Object.defineProperty(Wu,"__esModule",{value:!0});Wu.getContenteditableSlice=q5;var Y5=ns;function q5(t,e,n,o,r){var i;r===void 0&&(r=!1);var s=document.createRange();if(o==="left"?(s.setStart(t,0),s.setEnd(e,n)):(s.setStart(e,n),s.setEnd(t,t.childNodes.length)),r===!0){var a=s.extractContents();return(0,Y5.fragmentToString)(a)}var l=s.cloneContents(),c=document.createElement("div");c.appendChild(l);var d=(i=c.textContent)!==null&&i!==void 0?i:"";return d}Object.defineProperty(Hu,"__esModule",{value:!0});Hu.checkContenteditableSliceForEmptiness=Z5;var J5=ns,X5=Wu;function Z5(t,e,n,o){var r=(0,X5.getContenteditableSlice)(t,e,n,o);return(0,J5.isCollapsedWhitespaces)(r)}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.checkContenteditableSliceForEmptiness=void 0;var e=Hu;Object.defineProperty(t,"checkContenteditableSliceForEmptiness",{enumerable:!0,get:function(){return e.checkContenteditableSliceForEmptiness}})})(i_);var nk={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getContenteditableSlice=void 0;var e=Wu;Object.defineProperty(t,"getContenteditableSlice",{enumerable:!0,get:function(){return e.getContenteditableSlice}})})(nk);var ok={},z_={};Object.defineProperty(z_,"__esModule",{value:!0});z_.focus=e6;var Q5=ns;function e6(t,e){var n,o;if(e===void 0&&(e=!0),(0,Q5.isNativeInput)(t)){t.focus();var r=e?0:t.value.length;t.setSelectionRange(r,r)}else{var i=document.createRange(),s=window.getSelection();if(!s)return;var a=function(p){var f=document.createTextNode("");p.appendChild(f),i.setStart(f,0),i.setEnd(f,0)},l=function(p){return p!=null},c=t.childNodes,d=e?c[0]:c[c.length-1];if(l(d)){for(;l(d)&&d.nodeType!==Node.TEXT_NODE;)d=e?d.firstChild:d.lastChild;if(l(d)&&d.nodeType===Node.TEXT_NODE){var u=(o=(n=d.textContent)===null||n===void 0?void 0:n.length)!==null&&o!==void 0?o:0,r=e?0:u;i.setStart(d,r),i.setEnd(d,r)}else a(t)}else a(t);s.removeAllRanges(),s.addRange(i)}}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.focus=void 0;var e=z_;Object.defineProperty(t,"focus",{enumerable:!0,get:function(){return e.focus}})})(ok);var H_={},Gu={};Object.defineProperty(Gu,"__esModule",{value:!0});Gu.getCaretNodeAndOffset=t6;function t6(){var t=window.getSelection();if(t===null)return[null,0];var e=t.focusNode,n=t.focusOffset;return e===null?[null,0]:(e.nodeType!==Node.TEXT_NODE&&e.childNodes.length>0&&(e.childNodes[n]!==void 0?(e=e.childNodes[n],n=0):(e=e.childNodes[n-1],e.textContent!==null&&(n=e.textContent.length))),[e,n])}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getCaretNodeAndOffset=void 0;var e=Gu;Object.defineProperty(t,"getCaretNodeAndOffset",{enumerable:!0,get:function(){return e.getCaretNodeAndOffset}})})(H_);var rk={},Yu={};Object.defineProperty(Yu,"__esModule",{value:!0});Yu.getRange=n6;function n6(){var t=window.getSelection();return t&&t.rangeCount?t.getRangeAt(0):null}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getRange=void 0;var e=Yu;Object.defineProperty(t,"getRange",{enumerable:!0,get:function(){return e.getRange}})})(rk);var ik={},K_={};Object.defineProperty(K_,"__esModule",{value:!0});K_.isCaretAtEndOfInput=i6;var sS=ns,o6=H_,r6=i_;function i6(t){var e=(0,sS.getDeepestNode)(t,!0);if(e===null)return!0;if((0,sS.isNativeInput)(e))return e.selectionEnd===e.value.length;var n=(0,o6.getCaretNodeAndOffset)(),o=n[0],r=n[1];return o===null?!1:(0,r6.checkContenteditableSliceForEmptiness)(t,o,r,"right")}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isCaretAtEndOfInput=void 0;var e=K_;Object.defineProperty(t,"isCaretAtEndOfInput",{enumerable:!0,get:function(){return e.isCaretAtEndOfInput}})})(ik);var sk={},U_={};Object.defineProperty(U_,"__esModule",{value:!0});U_.isCaretAtStartOfInput=l6;var mu=ns,s6=Gu,a6=Hu;function l6(t){var e=(0,mu.getDeepestNode)(t);if(e===null||(0,mu.isEmpty)(t))return!0;if((0,mu.isNativeInput)(e))return e.selectionEnd===0;if((0,mu.isEmpty)(t))return!0;var n=(0,s6.getCaretNodeAndOffset)(),o=n[0],r=n[1];return o===null?!1:(0,a6.checkContenteditableSliceForEmptiness)(t,o,r,"left")}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isCaretAtStartOfInput=void 0;var e=U_;Object.defineProperty(t,"isCaretAtStartOfInput",{enumerable:!0,get:function(){return e.isCaretAtStartOfInput}})})(sk);var ak={},j_={};Object.defineProperty(j_,"__esModule",{value:!0});j_.save=u6;var c6=ns,d6=Yu;function u6(){var t=(0,d6.getRange)(),e=(0,c6.make)("span");if(e.id="cursor",e.hidden=!0,!!t)return t.insertNode(e),function(){var n=window.getSelection();n&&(t.setStartAfter(e),t.setEndAfter(e),n.removeAllRanges(),n.addRange(t),setTimeout(function(){e.remove()},150))}}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.save=void 0;var e=j_;Object.defineProperty(t,"save",{enumerable:!0,get:function(){return e.save}})})(ak);(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.save=t.isCaretAtStartOfInput=t.isCaretAtEndOfInput=t.getRange=t.getCaretNodeAndOffset=t.focus=t.getContenteditableSlice=t.checkContenteditableSliceForEmptiness=void 0;var e=i_;Object.defineProperty(t,"checkContenteditableSliceForEmptiness",{enumerable:!0,get:function(){return e.checkContenteditableSliceForEmptiness}});var n=nk;Object.defineProperty(t,"getContenteditableSlice",{enumerable:!0,get:function(){return n.getContenteditableSlice}});var o=ok;Object.defineProperty(t,"focus",{enumerable:!0,get:function(){return o.focus}});var r=H_;Object.defineProperty(t,"getCaretNodeAndOffset",{enumerable:!0,get:function(){return r.getCaretNodeAndOffset}});var i=rk;Object.defineProperty(t,"getRange",{enumerable:!0,get:function(){return i.getRange}});var s=ik;Object.defineProperty(t,"isCaretAtEndOfInput",{enumerable:!0,get:function(){return s.isCaretAtEndOfInput}});var a=sk;Object.defineProperty(t,"isCaretAtStartOfInput",{enumerable:!0,get:function(){return a.isCaretAtStartOfInput}});var l=ak;Object.defineProperty(t,"save",{enumerable:!0,get:function(){return l.save}})})(BS);var Rm=class extends Ie{keydown(e){switch(this.beforeKeydownProcessing(e),e.keyCode){case Ce.BACKSPACE:this.backspace(e);break;case Ce.DELETE:this.delete(e);break;case Ce.ENTER:this.enter(e);break;case Ce.DOWN:case Ce.RIGHT:this.arrowRightAndDown(e);break;case Ce.UP:case Ce.LEFT:this.arrowLeftAndUp(e);break;case Ce.TAB:this.tabPressed(e);break}e.key==="/"&&!e.ctrlKey&&!e.metaKey&&this.slashPressed(e),e.code==="Slash"&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),this.commandSlashPressed())}beforeKeydownProcessing(e){this.needToolbarClosing(e)&&uS(e.keyCode)&&(this.Editor.Toolbar.close(),e.ctrlKey||e.metaKey||e.altKey||e.shiftKey||this.Editor.BlockSelection.clearSelection(e))}keyup(e){e.shiftKey||this.Editor.UI.checkEmptiness()}dragOver(e){let n=this.Editor.BlockManager.getBlockByChildNode(e.target);n.dropTarget=!0}dragLeave(e){let n=this.Editor.BlockManager.getBlockByChildNode(e.target);n.dropTarget=!1}handleCommandC(e){let{BlockSelection:n}=this.Editor;n.anyBlockSelected&&n.copySelectedBlocks(e)}handleCommandX(e){let{BlockSelection:n,BlockManager:o,Caret:r}=this.Editor;n.anyBlockSelected&&n.copySelectedBlocks(e).then(()=>{let i=o.removeSelectedBlocks(),s=o.insertDefaultBlockAtIndex(i,!0);r.setToBlock(s,r.positions.START),n.clearSelection(e)})}tabPressed(e){let{InlineToolbar:n,Caret:o}=this.Editor;n.opened||(e.shiftKey?o.navigatePrevious(!0):o.navigateNext(!0))&&e.preventDefault()}commandSlashPressed(){this.Editor.BlockSelection.selectedBlocks.length>1||this.activateBlockSettings()}slashPressed(e){this.Editor.BlockManager.currentBlock.isEmpty&&(e.preventDefault(),this.Editor.Caret.insertContentAtCaretPosition("/"),this.activateToolbox())}enter(e){let{BlockManager:n,UI:o}=this.Editor,r=n.currentBlock;if(r===void 0||r.tool.isLineBreaksEnabled||o.someToolbarOpened&&o.someFlipperButtonFocused||e.shiftKey&&!om)return;let i=r;r.currentInput!==void 0&&yu(r.currentInput)&&!r.hasMedia?this.Editor.BlockManager.insertDefaultBlockAtIndex(this.Editor.BlockManager.currentBlockIndex):r.currentInput&&xu(r.currentInput)?i=this.Editor.BlockManager.insertDefaultBlockAtIndex(this.Editor.BlockManager.currentBlockIndex+1):i=this.Editor.BlockManager.split(),this.Editor.Caret.setToBlock(i),this.Editor.Toolbar.moveAndOpen(i),e.preventDefault()}backspace(e){let{BlockManager:n,Caret:o}=this.Editor,{currentBlock:r,previousBlock:i}=n;if(!(r===void 0||!ge.isCollapsed||!r.currentInput||!yu(r.currentInput))){if(e.preventDefault(),this.Editor.Toolbar.close(),r.currentInput!==r.firstInput){o.navigatePrevious();return}if(i!==null){if(i.isEmpty){n.removeBlock(i);return}if(r.isEmpty){n.removeBlock(r);let s=n.currentBlock;o.setToBlock(s,o.positions.END);return}eS(i,r)?this.mergeBlocks(i,r):o.setToBlock(i,o.positions.END)}}}delete(e){let{BlockManager:n,Caret:o}=this.Editor,{currentBlock:r,nextBlock:i}=n;if(!(!ge.isCollapsed||!xu(r.currentInput))){if(e.preventDefault(),this.Editor.Toolbar.close(),r.currentInput!==r.lastInput){o.navigateNext();return}if(i!==null){if(i.isEmpty){n.removeBlock(i);return}if(r.isEmpty){n.removeBlock(r),o.setToBlock(i,o.positions.START);return}eS(r,i)?this.mergeBlocks(r,i):o.setToBlock(i,o.positions.START)}}}mergeBlocks(e,n){let{BlockManager:o,Toolbar:r}=this.Editor;e.lastInput!==void 0&&(BS.focus(e.lastInput,!1),o.mergeBlocks(e,n).then(()=>{r.close()}))}arrowRightAndDown(e){let n=ga.usedKeys.includes(e.keyCode)&&(!e.shiftKey||e.keyCode===Ce.TAB);if(this.Editor.UI.someToolbarOpened&&n)return;this.Editor.Toolbar.close();let{currentBlock:o}=this.Editor.BlockManager,r=(o?.currentInput!==void 0?xu(o.currentInput):void 0)||this.Editor.BlockSelection.anyBlockSelected;if(e.shiftKey&&e.keyCode===Ce.DOWN&&r){this.Editor.CrossBlockSelection.toggleBlockSelectedState();return}if(e.keyCode===Ce.DOWN||e.keyCode===Ce.RIGHT&&!this.isRtl?this.Editor.Caret.navigateNext():this.Editor.Caret.navigatePrevious()){e.preventDefault();return}Cu(()=>{this.Editor.BlockManager.currentBlock&&this.Editor.BlockManager.currentBlock.updateCurrentInput()},20)(),this.Editor.BlockSelection.clearSelection(e)}arrowLeftAndUp(e){if(this.Editor.UI.someToolbarOpened){if(ga.usedKeys.includes(e.keyCode)&&(!e.shiftKey||e.keyCode===Ce.TAB))return;this.Editor.UI.closeAllToolbars()}this.Editor.Toolbar.close();let{currentBlock:n}=this.Editor.BlockManager,o=(n?.currentInput!==void 0?yu(n.currentInput):void 0)||this.Editor.BlockSelection.anyBlockSelected;if(e.shiftKey&&e.keyCode===Ce.UP&&o){this.Editor.CrossBlockSelection.toggleBlockSelectedState(!1);return}if(e.keyCode===Ce.UP||e.keyCode===Ce.LEFT&&!this.isRtl?this.Editor.Caret.navigatePrevious():this.Editor.Caret.navigateNext()){e.preventDefault();return}Cu(()=>{this.Editor.BlockManager.currentBlock&&this.Editor.BlockManager.currentBlock.updateCurrentInput()},20)(),this.Editor.BlockSelection.clearSelection(e)}needToolbarClosing(e){let n=e.keyCode===Ce.ENTER&&this.Editor.Toolbar.toolbox.opened,o=e.keyCode===Ce.ENTER&&this.Editor.BlockSettings.opened,r=e.keyCode===Ce.ENTER&&this.Editor.InlineToolbar.opened,i=e.keyCode===Ce.TAB;return!(e.shiftKey||i||n||o||r)}activateToolbox(){this.Editor.Toolbar.opened||this.Editor.Toolbar.moveAndOpen(),this.Editor.Toolbar.toolbox.open()}activateBlockSettings(){this.Editor.Toolbar.opened||this.Editor.Toolbar.moveAndOpen(),this.Editor.BlockSettings.opened||this.Editor.BlockSettings.open()}},Ql=class{constructor(e){this.blocks=[],this.workingArea=e}get length(){return this.blocks.length}get array(){return this.blocks}get nodes(){return pS(this.workingArea.children)}static set(e,n,o){return isNaN(Number(n))?(Reflect.set(e,n,o),!0):(e.insert(+n,o),!0)}static get(e,n){return isNaN(Number(n))?Reflect.get(e,n):e.get(+n)}push(e){this.blocks.push(e),this.insertToDOM(e)}swap(e,n){let o=this.blocks[n];z.swap(this.blocks[e].holder,o.holder),this.blocks[n]=this.blocks[e],this.blocks[e]=o}move(e,n){let o=this.blocks.splice(n,1)[0],r=e-1,i=Math.max(0,r),s=this.blocks[i];e>0?this.insertToDOM(o,"afterend",s):this.insertToDOM(o,"beforebegin",s),this.blocks.splice(e,0,o);let a=this.composeBlockEvent("move",{fromIndex:n,toIndex:e});o.call(_r.MOVED,a)}insert(e,n,o=!1){if(!this.length){this.push(n);return}e>this.length&&(e=this.length),o&&(this.blocks[e].holder.remove(),this.blocks[e].call(_r.REMOVED));let r=o?1:0;if(this.blocks.splice(e,r,n),e>0){let i=this.blocks[e-1];this.insertToDOM(n,"afterend",i)}else{let i=this.blocks[e+1];i?this.insertToDOM(n,"beforebegin",i):this.insertToDOM(n)}}replace(e,n){if(this.blocks[e]===void 0)throw Error("Incorrect index");this.blocks[e].holder.replaceWith(n.holder),this.blocks[e]=n}insertMany(e,n){let o=new DocumentFragment;for(let r of e)o.appendChild(r.holder);if(this.length>0){if(n>0){let r=Math.min(n-1,this.length-1);this.blocks[r].holder.after(o)}else n===0&&this.workingArea.prepend(o);this.blocks.splice(n,0,...e)}else this.blocks.push(...e),this.workingArea.appendChild(o);e.forEach(r=>r.call(_r.RENDERED))}remove(e){isNaN(e)&&(e=this.length-1),this.blocks[e].holder.remove(),this.blocks[e].call(_r.REMOVED),this.blocks.splice(e,1)}removeAll(){this.workingArea.innerHTML="",this.blocks.forEach(e=>e.call(_r.REMOVED)),this.blocks.length=0}insertAfter(e,n){let o=this.blocks.indexOf(e);this.insert(o+1,n)}get(e){return this.blocks[e]}indexOf(e){return this.blocks.indexOf(e)}insertToDOM(e,n,o){n?o.holder.insertAdjacentElement(n,e.holder):this.workingArea.appendChild(e.holder),e.call(_r.RENDERED)}composeBlockEvent(e,n){return new CustomEvent(e,{detail:n})}},aS="block-removed",lS="block-added",p6="block-moved",cS="block-changed",Pm=class{constructor(){this.completed=Promise.resolve()}add(e){return new Promise((n,o)=>{this.completed=this.completed.then(e).then(n).catch(o)})}},Fm=class extends Ie{constructor(){super(...arguments),this._currentBlockIndex=-1,this._blocks=null}get currentBlockIndex(){return this._currentBlockIndex}set currentBlockIndex(e){this._currentBlockIndex=e}get firstBlock(){return this._blocks[0]}get lastBlock(){return this._blocks[this._blocks.length-1]}get currentBlock(){return this._blocks[this.currentBlockIndex]}set currentBlock(e){this.currentBlockIndex=this.getBlockIndex(e)}get nextBlock(){return this.currentBlockIndex===this._blocks.length-1?null:this._blocks[this.currentBlockIndex+1]}get nextContentfulBlock(){return this.blocks.slice(this.currentBlockIndex+1).find(e=>!!e.inputs.length)}get previousContentfulBlock(){return this.blocks.slice(0,this.currentBlockIndex).reverse().find(e=>!!e.inputs.length)}get previousBlock(){return this.currentBlockIndex===0?null:this._blocks[this.currentBlockIndex-1]}get blocks(){return this._blocks.array}get isEditorEmpty(){return this.blocks.every(e=>e.isEmpty)}prepare(){let e=new Ql(this.Editor.UI.nodes.redactor);this._blocks=new Proxy(e,{set:Ql.set,get:Ql.get}),this.listeners.on(document,"copy",n=>this.Editor.BlockEvents.handleCommandC(n))}toggleReadOnly(e){e?this.disableModuleBindings():this.enableModuleBindings()}composeBlock({tool:e,data:n={},id:o=void 0,tunes:r={}}){let i=this.Editor.ReadOnly.isEnabled,s=this.Editor.Tools.blockTools.get(e),a=new go({id:o,data:n,tool:s,api:this.Editor.API,readOnly:i,tunesData:r},this.eventsDispatcher);return i||window.requestIdleCallback(()=>{this.bindBlockEvents(a)},{timeout:2e3}),a}insert({id:e=void 0,tool:n=this.config.defaultBlock,data:o={},index:r,needToFocus:i=!0,replace:s=!1,tunes:a={}}={}){let l=r;l===void 0&&(l=this.currentBlockIndex+(s?0:1));let c=this.composeBlock({id:e,tool:n,data:o,tunes:a});return s&&this.blockDidMutated(aS,this.getBlockByIndex(l),{index:l}),this._blocks.insert(l,c,s),this.blockDidMutated(lS,c,{index:l}),i?this.currentBlockIndex=l:l<=this.currentBlockIndex&&this.currentBlockIndex++,c}insertMany(e,n=0){this._blocks.insertMany(e,n)}async update(e,n,o){if(!n&&!o)return e;let r=await e.data,i=this.composeBlock({id:e.id,tool:e.name,data:Object.assign({},r,n??{}),tunes:o??e.tunes}),s=this.getBlockIndex(e);return this._blocks.replace(s,i),this.blockDidMutated(cS,i,{index:s}),i}replace(e,n,o){let r=this.getBlockIndex(e);return this.insert({tool:n,data:o,index:r,replace:!0})}paste(e,n,o=!1){let r=this.insert({tool:e,replace:o});try{window.requestIdleCallback(()=>{r.call(_r.ON_PASTE,n)})}catch(i){Ue(`${e}: onPaste callback call is failed`,"error",i)}return r}insertDefaultBlockAtIndex(e,n=!1){let o=this.composeBlock({tool:this.config.defaultBlock});return this._blocks[e]=o,this.blockDidMutated(lS,o,{index:e}),n?this.currentBlockIndex=e:e<=this.currentBlockIndex&&this.currentBlockIndex++,o}insertAtEnd(){return this.currentBlockIndex=this.blocks.length-1,this.insert()}async mergeBlocks(e,n){let o;if(e.name===n.name&&e.mergeable){let r=await n.data;if(lo(r)){console.error("Could not merge Block. Failed to extract original Block data.");return}let[i]=e_([r],e.tool.sanitizeConfig);o=i}else if(e.mergeable&&Tu(n,"export")&&Tu(e,"import")){let r=await n.exportDataAsString(),i=zo(r,e.tool.sanitizeConfig);o=tS(i,e.tool.conversionConfig)}o!==void 0&&(await e.mergeWith(o),this.removeBlock(n),this.currentBlockIndex=this._blocks.indexOf(e))}removeBlock(e,n=!0){return new Promise(o=>{let r=this._blocks.indexOf(e);if(!this.validateIndex(r))throw new Error("Can't find a Block to remove");e.destroy(),this._blocks.remove(r),this.blockDidMutated(aS,e,{index:r}),this.currentBlockIndex>=r&&this.currentBlockIndex--,this.blocks.length?r===0&&(this.currentBlockIndex=0):(this.unsetCurrentBlock(),n&&this.insert()),o()})}removeSelectedBlocks(){let e;for(let n=this.blocks.length-1;n>=0;n--)this.blocks[n].selected&&(this.removeBlock(this.blocks[n]),e=n);return e}removeAllBlocks(){for(let e=this.blocks.length-1;e>=0;e--)this._blocks.remove(e);this.unsetCurrentBlock(),this.insert(),this.currentBlock.firstInput.focus()}split(){let e=this.Editor.Caret.extractFragmentFromCaretPosition(),n=z.make("div");n.appendChild(e);let o={text:z.isEmpty(n)?"":n.innerHTML};return this.insert({data:o})}getBlockByIndex(e){return e===-1&&(e=this._blocks.length-1),this._blocks[e]}getBlockIndex(e){return this._blocks.indexOf(e)}getBlockById(e){return this._blocks.array.find(n=>n.id===e)}getBlock(e){z.isElement(e)||(e=e.parentNode);let n=this._blocks.nodes,o=e.closest(`.${go.CSS.wrapper}`),r=n.indexOf(o);if(r>=0)return this._blocks[r]}setCurrentBlockByChildNode(e){z.isElement(e)||(e=e.parentNode);let n=e.closest(`.${go.CSS.wrapper}`);if(!n)return;let o=n.closest(`.${this.Editor.UI.CSS.editorWrapper}`);if(o!=null&&o.isEqualNode(this.Editor.UI.nodes.wrapper))return this.currentBlockIndex=this._blocks.nodes.indexOf(n),this.currentBlock.updateCurrentInput(),this.currentBlock}getBlockByChildNode(e){if(!e||!(e instanceof Node))return;z.isElement(e)||(e=e.parentNode);let n=e.closest(`.${go.CSS.wrapper}`);return this.blocks.find(o=>o.holder===n)}swap(e,n){this._blocks.swap(e,n),this.currentBlockIndex=n}move(e,n=this.currentBlockIndex){if(isNaN(e)||isNaN(n)){Ue("Warning during 'move' call: incorrect indices provided.","warn");return}if(!this.validateIndex(e)||!this.validateIndex(n)){Ue("Warning during 'move' call: indices cannot be lower than 0 or greater than the amount of blocks.","warn");return}this._blocks.move(e,n),this.currentBlockIndex=e,this.blockDidMutated(p6,this.currentBlock,{fromIndex:n,toIndex:e})}async convert(e,n,o){if(!await e.save())throw new Error("Could not convert Block. Failed to extract original Block data.");let r=this.Editor.Tools.blockTools.get(n);if(!r)throw new Error(`Could not convert Block. Tool \xAB${n}\xBB not found.`);let i=await e.exportDataAsString(),s=zo(i,r.sanitizeConfig),a=tS(s,r.conversionConfig,r.settings);return o&&(a=Object.assign(a,o)),this.replace(e,r.name,a)}unsetCurrentBlock(){this.currentBlockIndex=-1}async clear(e=!1){let n=new Pm;this.blocks.forEach(o=>{n.add(async()=>{await this.removeBlock(o,!1)})}),await n.completed,this.unsetCurrentBlock(),e&&this.insert(),this.Editor.UI.checkEmptiness()}async destroy(){await Promise.all(this.blocks.map(e=>e.destroy()))}bindBlockEvents(e){let{BlockEvents:n}=this.Editor;this.readOnlyMutableListeners.on(e.holder,"keydown",o=>{n.keydown(o)}),this.readOnlyMutableListeners.on(e.holder,"keyup",o=>{n.keyup(o)}),this.readOnlyMutableListeners.on(e.holder,"dragover",o=>{n.dragOver(o)}),this.readOnlyMutableListeners.on(e.holder,"dragleave",o=>{n.dragLeave(o)}),e.on("didMutated",o=>this.blockDidMutated(cS,o,{index:this.getBlockIndex(o)}))}disableModuleBindings(){this.readOnlyMutableListeners.clearAll()}enableModuleBindings(){this.readOnlyMutableListeners.on(document,"cut",e=>this.Editor.BlockEvents.handleCommandX(e)),this.blocks.forEach(e=>{this.bindBlockEvents(e)})}validateIndex(e){return!(e<0||e>=this._blocks.length)}blockDidMutated(e,n,o){let r=new CustomEvent(e,{detail:{target:new mr(n),...o}});return this.eventsDispatcher.emit(_S,{event:r}),n}},Bm=class extends Ie{constructor(){super(...arguments),this.anyBlockSelectedCache=null,this.needToSelectAll=!1,this.nativeInputSelected=!1,this.readyToBlockSelection=!1}get sanitizerConfig(){return{p:{},h1:{},h2:{},h3:{},h4:{},h5:{},h6:{},ol:{},ul:{},li:{},br:!0,img:{src:!0,width:!0,height:!0},a:{href:!0},b:{},i:{},u:{}}}get allBlocksSelected(){let{BlockManager:e}=this.Editor;return e.blocks.every(n=>n.selected===!0)}set allBlocksSelected(e){let{BlockManager:n}=this.Editor;n.blocks.forEach(o=>{o.selected=e}),this.clearCache()}get anyBlockSelected(){let{BlockManager:e}=this.Editor;return this.anyBlockSelectedCache===null&&(this.anyBlockSelectedCache=e.blocks.some(n=>n.selected===!0)),this.anyBlockSelectedCache}get selectedBlocks(){return this.Editor.BlockManager.blocks.filter(e=>e.selected)}prepare(){this.selection=new ge,ma.add({name:"CMD+A",handler:e=>{let{BlockManager:n,ReadOnly:o}=this.Editor;if(o.isEnabled){e.preventDefault(),this.selectAllBlocks();return}n.currentBlock&&this.handleCommandA(e)},on:this.Editor.UI.nodes.redactor})}toggleReadOnly(){ge.get().removeAllRanges(),this.allBlocksSelected=!1}unSelectBlockByIndex(e){let{BlockManager:n}=this.Editor,o;isNaN(e)?o=n.currentBlock:o=n.getBlockByIndex(e),o.selected=!1,this.clearCache()}clearSelection(e,n=!1){let{BlockManager:o,Caret:r,RectangleSelection:i}=this.Editor;this.needToSelectAll=!1,this.nativeInputSelected=!1,this.readyToBlockSelection=!1;let s=e&&e instanceof KeyboardEvent,a=s&&uS(e.keyCode);if(this.anyBlockSelected&&s&&a&&!ge.isSelectionExists){let l=o.removeSelectedBlocks();o.insertDefaultBlockAtIndex(l,!0),r.setToBlock(o.currentBlock),Cu(()=>{let c=e.key;r.insertContentAtCaretPosition(c.length>1?"":c)},20)()}if(this.Editor.CrossBlockSelection.clear(e),!this.anyBlockSelected||i.isRectActivated()){this.Editor.RectangleSelection.clearSelection();return}n&&this.selection.restore(),this.allBlocksSelected=!1}copySelectedBlocks(e){e.preventDefault();let n=z.make("div");this.selectedBlocks.forEach(i=>{let s=zo(i.holder.innerHTML,this.sanitizerConfig),a=z.make("p");a.innerHTML=s,n.appendChild(a)});let o=Array.from(n.childNodes).map(i=>i.textContent).join(`
|
|
101
|
-
|
|
102
|
-
`),r=n.innerHTML;return e.clipboardData.setData("text/plain",o),e.clipboardData.setData("text/html",r),Promise.all(this.selectedBlocks.map(i=>i.save())).then(i=>{try{e.clipboardData.setData(this.Editor.Paste.MIME_TYPE,JSON.stringify(i))}catch{}})}selectBlockByIndex(e){let{BlockManager:n}=this.Editor,o=n.getBlockByIndex(e);o!==void 0&&this.selectBlock(o)}selectBlock(e){this.selection.save(),ge.get().removeAllRanges(),e.selected=!0,this.clearCache(),this.Editor.InlineToolbar.close()}unselectBlock(e){e.selected=!1,this.clearCache()}clearCache(){this.anyBlockSelectedCache=null}destroy(){ma.remove(this.Editor.UI.nodes.redactor,"CMD+A")}handleCommandA(e){if(this.Editor.RectangleSelection.clearSelection(),z.isNativeInput(e.target)&&!this.readyToBlockSelection){this.readyToBlockSelection=!0;return}let n=this.Editor.BlockManager.getBlock(e.target),o=n.inputs;if(o.length>1&&!this.readyToBlockSelection){this.readyToBlockSelection=!0;return}if(o.length===1&&!this.needToSelectAll){this.needToSelectAll=!0;return}this.needToSelectAll?(e.preventDefault(),this.selectAllBlocks(),this.needToSelectAll=!1,this.readyToBlockSelection=!1):this.readyToBlockSelection&&(e.preventDefault(),this.selectBlock(n),this.needToSelectAll=!0)}selectAllBlocks(){this.selection.save(),ge.get().removeAllRanges(),this.allBlocksSelected=!0,this.Editor.InlineToolbar.close()}},$m=class t extends Ie{get positions(){return{START:"start",END:"end",DEFAULT:"default"}}static get CSS(){return{shadowCaret:"cdx-shadow-caret"}}setToBlock(e,n=this.positions.DEFAULT,o=0){var r;let{BlockManager:i,BlockSelection:s}=this.Editor;if(s.clearSelection(),!e.focusable){(r=window.getSelection())==null||r.removeAllRanges(),s.selectBlock(e),i.currentBlock=e;return}let a;switch(n){case this.positions.START:a=e.firstInput;break;case this.positions.END:a=e.lastInput;break;default:a=e.currentInput}if(!a)return;let l=z.getDeepestNode(a,n===this.positions.END),c=z.getContentLength(l);switch(!0){case n===this.positions.START:o=0;break;case n===this.positions.END:case o>c:o=c;break}this.set(l,o),i.setCurrentBlockByChildNode(e.holder),i.currentBlock.currentInput=a}setToInput(e,n=this.positions.DEFAULT,o=0){let{currentBlock:r}=this.Editor.BlockManager,i=z.getDeepestNode(e);switch(n){case this.positions.START:this.set(i,0);break;case this.positions.END:this.set(i,z.getContentLength(i));break;default:o&&this.set(i,o)}r.currentInput=e}set(e,n=0){let{top:o,bottom:r}=ge.setCursor(e,n),{innerHeight:i}=window;o<0?window.scrollBy(0,o-30):r>i&&window.scrollBy(0,r-i+30)}setToTheLastBlock(){let e=this.Editor.BlockManager.lastBlock;if(e)if(e.tool.isDefault&&e.isEmpty)this.setToBlock(e);else{let n=this.Editor.BlockManager.insertAtEnd();this.setToBlock(n)}}extractFragmentFromCaretPosition(){let e=ge.get();if(e.rangeCount){let n=e.getRangeAt(0),o=this.Editor.BlockManager.currentBlock.currentInput;if(n.deleteContents(),o)if(z.isNativeInput(o)){let r=o,i=document.createDocumentFragment(),s=r.value.substring(0,r.selectionStart),a=r.value.substring(r.selectionStart);return i.textContent=a,r.value=s,i}else{let r=n.cloneRange();return r.selectNodeContents(o),r.setStart(n.endContainer,n.endOffset),r.extractContents()}}}navigateNext(e=!1){let{BlockManager:n}=this.Editor,{currentBlock:o,nextBlock:r}=n;if(o===void 0)return!1;let{nextInput:i,currentInput:s}=o,a=s!==void 0?xu(s):void 0,l=r,c=e||a||!o.focusable;if(i&&c)return this.setToInput(i,this.positions.START),!0;if(l===null){if(o.tool.isDefault||!c)return!1;l=n.insertAtEnd()}return c?(this.setToBlock(l,this.positions.START),!0):!1}navigatePrevious(e=!1){let{currentBlock:n,previousBlock:o}=this.Editor.BlockManager;if(!n)return!1;let{previousInput:r,currentInput:i}=n,s=i!==void 0?yu(i):void 0,a=e||s||!n.focusable;return r&&a?(this.setToInput(r,this.positions.END),!0):o!==null&&a?(this.setToBlock(o,this.positions.END),!0):!1}createShadow(e){let n=document.createElement("span");n.classList.add(t.CSS.shadowCaret),e.insertAdjacentElement("beforeend",n)}restoreCaret(e){let n=e.querySelector(`.${t.CSS.shadowCaret}`);if(!n)return;new ge().expandToTag(n);let o=document.createRange();o.selectNode(n),o.extractContents()}insertContentAtCaretPosition(e){let n=document.createDocumentFragment(),o=document.createElement("div"),r=ge.get(),i=ge.range;o.innerHTML=e,Array.from(o.childNodes).forEach(c=>n.appendChild(c)),n.childNodes.length===0&&n.appendChild(new Text);let s=n.lastChild;i.deleteContents(),i.insertNode(n);let a=document.createRange(),l=s.nodeType===Node.TEXT_NODE?s:s.firstChild;l!==null&&l.textContent!==null&&a.setStart(l,l.textContent.length),r.removeAllRanges(),r.addRange(a)}},zm=class extends Ie{constructor(){super(...arguments),this.onMouseUp=()=>{this.listeners.off(document,"mouseover",this.onMouseOver),this.listeners.off(document,"mouseup",this.onMouseUp)},this.onMouseOver=e=>{let{BlockManager:n,BlockSelection:o}=this.Editor;if(e.relatedTarget===null&&e.target===null)return;let r=n.getBlockByChildNode(e.relatedTarget)||this.lastSelectedBlock,i=n.getBlockByChildNode(e.target);if(!(!r||!i)&&i!==r){if(r===this.firstSelectedBlock){ge.get().removeAllRanges(),r.selected=!0,i.selected=!0,o.clearCache();return}if(i===this.firstSelectedBlock){r.selected=!1,i.selected=!1,o.clearCache();return}this.Editor.InlineToolbar.close(),this.toggleBlocksSelectedState(r,i),this.lastSelectedBlock=i}}}async prepare(){this.listeners.on(document,"mousedown",e=>{this.enableCrossBlockSelection(e)})}watchSelection(e){if(e.button!==OH.LEFT)return;let{BlockManager:n}=this.Editor;this.firstSelectedBlock=n.getBlock(e.target),this.lastSelectedBlock=this.firstSelectedBlock,this.listeners.on(document,"mouseover",this.onMouseOver),this.listeners.on(document,"mouseup",this.onMouseUp)}get isCrossBlockSelectionStarted(){return!!this.firstSelectedBlock&&!!this.lastSelectedBlock&&this.firstSelectedBlock!==this.lastSelectedBlock}toggleBlockSelectedState(e=!0){let{BlockManager:n,BlockSelection:o}=this.Editor;this.lastSelectedBlock||(this.lastSelectedBlock=this.firstSelectedBlock=n.currentBlock),this.firstSelectedBlock===this.lastSelectedBlock&&(this.firstSelectedBlock.selected=!0,o.clearCache(),ge.get().removeAllRanges());let r=n.blocks.indexOf(this.lastSelectedBlock)+(e?1:-1),i=n.blocks[r];i&&(this.lastSelectedBlock.selected!==i.selected?(i.selected=!0,o.clearCache()):(this.lastSelectedBlock.selected=!1,o.clearCache()),this.lastSelectedBlock=i,this.Editor.InlineToolbar.close(),i.holder.scrollIntoView({block:"nearest"}))}clear(e){let{BlockManager:n,BlockSelection:o,Caret:r}=this.Editor,i=n.blocks.indexOf(this.firstSelectedBlock),s=n.blocks.indexOf(this.lastSelectedBlock);if(o.anyBlockSelected&&i>-1&&s>-1&&e&&e instanceof KeyboardEvent)switch(e.keyCode){case Ce.DOWN:case Ce.RIGHT:r.setToBlock(n.blocks[Math.max(i,s)],r.positions.END);break;case Ce.UP:case Ce.LEFT:r.setToBlock(n.blocks[Math.min(i,s)],r.positions.START);break;default:r.setToBlock(n.blocks[Math.max(i,s)],r.positions.END)}this.firstSelectedBlock=this.lastSelectedBlock=null}enableCrossBlockSelection(e){let{UI:n}=this.Editor;ge.isCollapsed||this.Editor.BlockSelection.clearSelection(e),n.nodes.redactor.contains(e.target)?this.watchSelection(e):this.Editor.BlockSelection.clearSelection(e)}toggleBlocksSelectedState(e,n){let{BlockManager:o,BlockSelection:r}=this.Editor,i=o.blocks.indexOf(e),s=o.blocks.indexOf(n),a=e.selected!==n.selected;for(let l=Math.min(i,s);l<=Math.max(i,s);l++){let c=o.blocks[l];c!==this.firstSelectedBlock&&c!==(a?e:n)&&(o.blocks[l].selected=!o.blocks[l].selected,r.clearCache())}}},Hm=class extends Ie{constructor(){super(...arguments),this.isStartedAtEditor=!1}toggleReadOnly(e){e?this.disableModuleBindings():this.enableModuleBindings()}enableModuleBindings(){let{UI:e}=this.Editor;this.readOnlyMutableListeners.on(e.nodes.holder,"drop",async n=>{await this.processDrop(n)},!0),this.readOnlyMutableListeners.on(e.nodes.holder,"dragstart",()=>{this.processDragStart()}),this.readOnlyMutableListeners.on(e.nodes.holder,"dragover",n=>{this.processDragOver(n)},!0)}disableModuleBindings(){this.readOnlyMutableListeners.clearAll()}async processDrop(e){let{BlockManager:n,Paste:o,Caret:r}=this.Editor;e.preventDefault(),n.blocks.forEach(s=>{s.dropTarget=!1}),ge.isAtEditor&&!ge.isCollapsed&&this.isStartedAtEditor&&document.execCommand("delete"),this.isStartedAtEditor=!1;let i=n.setCurrentBlockByChildNode(e.target);if(i)this.Editor.Caret.setToBlock(i,r.positions.END);else{let s=n.setCurrentBlockByChildNode(n.lastBlock.holder);this.Editor.Caret.setToBlock(s,r.positions.END)}await o.processDataTransfer(e.dataTransfer,!0)}processDragStart(){ge.isAtEditor&&!ge.isCollapsed&&(this.isStartedAtEditor=!0),this.Editor.InlineToolbar.close()}processDragOver(e){e.preventDefault()}},f6=180,h6=400,Km=class extends Ie{constructor({config:e,eventsDispatcher:n}){super({config:e,eventsDispatcher:n}),this.disabled=!1,this.batchingTimeout=null,this.batchingOnChangeQueue=new Map,this.batchTime=h6,this.mutationObserver=new MutationObserver(o=>{this.redactorChanged(o)}),this.eventsDispatcher.on(_S,o=>{this.particularBlockChanged(o.event)}),this.eventsDispatcher.on(bS,()=>{this.disable()}),this.eventsDispatcher.on(yS,()=>{this.enable()})}enable(){this.mutationObserver.observe(this.Editor.UI.nodes.redactor,{childList:!0,subtree:!0,characterData:!0,attributes:!0}),this.disabled=!1}disable(){this.mutationObserver.disconnect(),this.disabled=!0}particularBlockChanged(e){this.disabled||!lt(this.config.onChange)||(this.batchingOnChangeQueue.set(`block:${e.detail.target.id}:event:${e.type}`,e),this.batchingTimeout&&clearTimeout(this.batchingTimeout),this.batchingTimeout=setTimeout(()=>{let n;this.batchingOnChangeQueue.size===1?n=this.batchingOnChangeQueue.values().next().value:n=Array.from(this.batchingOnChangeQueue.values()),this.config.onChange&&this.config.onChange(this.Editor.API.methods,n),this.batchingOnChangeQueue.clear()},this.batchTime))}redactorChanged(e){this.eventsDispatcher.emit(rm,{mutations:e})}},lk=class ck extends Ie{constructor(){super(...arguments),this.MIME_TYPE="application/x-editor-js",this.toolsTags={},this.tagsByTool={},this.toolsPatterns=[],this.toolsFiles={},this.exceptionList=[],this.processTool=e=>{try{let n=e.create({},{},!1);if(e.pasteConfig===!1){this.exceptionList.push(e.name);return}if(!lt(n.onPaste))return;this.getTagsConfig(e),this.getFilesConfig(e),this.getPatternsConfig(e)}catch(n){Ue(`Paste handling for \xAB${e.name}\xBB Tool hasn't been set up because of the error`,"warn",n)}},this.handlePasteEvent=async e=>{let{BlockManager:n,Toolbar:o}=this.Editor,r=n.setCurrentBlockByChildNode(e.target);!r||this.isNativeBehaviour(e.target)&&!e.clipboardData.types.includes("Files")||r&&this.exceptionList.includes(r.name)||(e.preventDefault(),this.processDataTransfer(e.clipboardData),o.close())}}async prepare(){this.processTools()}toggleReadOnly(e){e?this.unsetCallback():this.setCallback()}async processDataTransfer(e,n=!1){let{Tools:o}=this.Editor,r=e.types;if((r.includes?r.includes("Files"):r.contains("Files"))&&!lo(this.toolsFiles)){await this.processFiles(e.files);return}let i=e.getData(this.MIME_TYPE),s=e.getData("text/plain"),a=e.getData("text/html");if(i)try{this.insertEditorJSData(JSON.parse(i));return}catch{}n&&s.trim()&&a.trim()&&(a="<p>"+(a.trim()?a:s)+"</p>");let l=Object.keys(this.toolsTags).reduce((u,p)=>(u[p.toLowerCase()]=this.toolsTags[p].sanitizationConfig??{},u),{}),c=Object.assign({},l,o.getAllInlineToolsSanitizeConfig(),{br:{}}),d=zo(a,c);!d.trim()||d.trim()===s||!z.isHTMLString(d)?await this.processText(s):await this.processText(d,!0)}async processText(e,n=!1){let{Caret:o,BlockManager:r}=this.Editor,i=n?this.processHTML(e):this.processPlain(e);if(!i.length)return;if(i.length===1){i[0].isBlock?this.processSingleBlock(i.pop()):this.processInlinePaste(i.pop());return}let s=r.currentBlock&&r.currentBlock.tool.isDefault&&r.currentBlock.isEmpty;i.map(async(a,l)=>this.insertBlock(a,l===0&&s)),r.currentBlock&&o.setToBlock(r.currentBlock,o.positions.END)}setCallback(){this.listeners.on(this.Editor.UI.nodes.holder,"paste",this.handlePasteEvent)}unsetCallback(){this.listeners.off(this.Editor.UI.nodes.holder,"paste",this.handlePasteEvent)}processTools(){let e=this.Editor.Tools.blockTools;Array.from(e.values()).forEach(this.processTool)}collectTagNames(e){return yr(e)?[e]:nn(e)?Object.keys(e):[]}getTagsConfig(e){if(e.pasteConfig===!1)return;let n=e.pasteConfig.tags||[],o=[];n.forEach(r=>{let i=this.collectTagNames(r);o.push(...i),i.forEach(s=>{if(Object.prototype.hasOwnProperty.call(this.toolsTags,s)){Ue(`Paste handler for \xAB${e.name}\xBB Tool on \xAB${s}\xBB tag is skipped because it is already used by \xAB${this.toolsTags[s].tool.name}\xBB Tool.`,"warn");return}let a=nn(r)?r[s]:null;this.toolsTags[s.toUpperCase()]={tool:e,sanitizationConfig:a}})}),this.tagsByTool[e.name]=o.map(r=>r.toUpperCase())}getFilesConfig(e){if(e.pasteConfig===!1)return;let{files:n={}}=e.pasteConfig,{extensions:o,mimeTypes:r}=n;!o&&!r||(o&&!Array.isArray(o)&&(Ue(`\xABextensions\xBB property of the onDrop config for \xAB${e.name}\xBB Tool should be an array`),o=[]),r&&!Array.isArray(r)&&(Ue(`\xABmimeTypes\xBB property of the onDrop config for \xAB${e.name}\xBB Tool should be an array`),r=[]),r&&(r=r.filter(i=>RH(i)?!0:(Ue(`MIME type value \xAB${i}\xBB for the \xAB${e.name}\xBB Tool is not a valid MIME type`,"warn"),!1))),this.toolsFiles[e.name]={extensions:o||[],mimeTypes:r||[]})}getPatternsConfig(e){e.pasteConfig===!1||!e.pasteConfig.patterns||lo(e.pasteConfig.patterns)||Object.entries(e.pasteConfig.patterns).forEach(([n,o])=>{o instanceof RegExp||Ue(`Pattern ${o} for \xAB${e.name}\xBB Tool is skipped because it should be a Regexp instance.`,"warn"),this.toolsPatterns.push({key:n,pattern:o,tool:e})})}isNativeBehaviour(e){return z.isNativeInput(e)}async processFiles(e){let{BlockManager:n}=this.Editor,o;o=await Promise.all(Array.from(e).map(i=>this.processFile(i))),o=o.filter(i=>!!i);let r=n.currentBlock.tool.isDefault&&n.currentBlock.isEmpty;o.forEach((i,s)=>{n.paste(i.type,i.event,s===0&&r)})}async processFile(e){let n=LH(e),o=Object.entries(this.toolsFiles).find(([i,{mimeTypes:s,extensions:a}])=>{let[l,c]=e.type.split("/"),d=a.find(p=>p.toLowerCase()===n.toLowerCase()),u=s.find(p=>{let[f,h]=p.split("/");return f===l&&(h===c||h==="*")});return!!d||!!u});if(!o)return;let[r]=o;return{event:this.composePasteEvent("file",{file:e}),type:r}}processHTML(e){let{Tools:n}=this.Editor,o=z.make("DIV");return o.innerHTML=e,this.getNodes(o).map(r=>{let i,s=n.defaultTool,a=!1;switch(r.nodeType){case Node.DOCUMENT_FRAGMENT_NODE:i=z.make("div"),i.appendChild(r);break;case Node.ELEMENT_NODE:i=r,a=!0,this.toolsTags[i.tagName]&&(s=this.toolsTags[i.tagName].tool);break}let{tags:l}=s.pasteConfig||{tags:[]},c=l.reduce((p,f)=>(this.collectTagNames(f).forEach(h=>{let m=nn(f)?f[h]:null;p[h.toLowerCase()]=m||{}}),p),{}),d=Object.assign({},c,s.baseSanitizeConfig);if(i.tagName.toLowerCase()==="table"){let p=zo(i.outerHTML,d);i=z.make("div",void 0,{innerHTML:p}).firstChild}else i.innerHTML=zo(i.innerHTML,d);let u=this.composePasteEvent("tag",{data:i});return{content:i,isBlock:a,tool:s.name,event:u}}).filter(r=>{let i=z.isEmpty(r.content),s=z.isSingleTag(r.content);return!i||s})}processPlain(e){let{defaultBlock:n}=this.config;if(!e)return[];let o=n;return e.split(/\r?\n/).filter(r=>r.trim()).map(r=>{let i=z.make("div");i.textContent=r;let s=this.composePasteEvent("tag",{data:i});return{content:i,tool:o,isBlock:!1,event:s}})}async processSingleBlock(e){let{Caret:n,BlockManager:o}=this.Editor,{currentBlock:r}=o;if(!r||e.tool!==r.name||!z.containsOnlyInlineElements(e.content.innerHTML)){this.insertBlock(e,r?.tool.isDefault&&r.isEmpty);return}n.insertContentAtCaretPosition(e.content.innerHTML)}async processInlinePaste(e){let{BlockManager:n,Caret:o}=this.Editor,{content:r}=e;if(n.currentBlock&&n.currentBlock.tool.isDefault&&r.textContent.length<ck.PATTERN_PROCESSING_MAX_LENGTH){let i=await this.processPattern(r.textContent);if(i){let s=n.currentBlock&&n.currentBlock.tool.isDefault&&n.currentBlock.isEmpty,a=n.paste(i.tool,i.event,s);o.setToBlock(a,o.positions.END);return}}if(n.currentBlock&&n.currentBlock.currentInput){let i=n.currentBlock.tool.baseSanitizeConfig;document.execCommand("insertHTML",!1,zo(r.innerHTML,i))}else this.insertBlock(e)}async processPattern(e){let n=this.toolsPatterns.find(o=>{let r=o.pattern.exec(e);return r?e===r.shift():!1});return n?{event:this.composePasteEvent("pattern",{key:n.key,data:e}),tool:n.tool.name}:void 0}insertBlock(e,n=!1){let{BlockManager:o,Caret:r}=this.Editor,{currentBlock:i}=o,s;if(n&&i&&i.isEmpty){s=o.paste(e.tool,e.event,!0),r.setToBlock(s,r.positions.END);return}s=o.paste(e.tool,e.event),r.setToBlock(s,r.positions.END)}insertEditorJSData(e){let{BlockManager:n,Caret:o,Tools:r}=this.Editor;e_(e,i=>r.blockTools.get(i).sanitizeConfig).forEach(({tool:i,data:s},a)=>{let l=!1;a===0&&(l=n.currentBlock&&n.currentBlock.tool.isDefault&&n.currentBlock.isEmpty);let c=n.insert({tool:i,data:s,replace:l});o.setToBlock(c,o.positions.END)})}processElementNode(e,n,o){let r=Object.keys(this.toolsTags),i=e,{tool:s}=this.toolsTags[i.tagName]||{},a=this.tagsByTool[s?.name]||[],l=r.includes(i.tagName),c=z.blockElements.includes(i.tagName.toLowerCase()),d=Array.from(i.children).some(({tagName:p})=>r.includes(p)&&!a.includes(p)),u=Array.from(i.children).some(({tagName:p})=>z.blockElements.includes(p.toLowerCase()));if(!c&&!l&&!d)return o.appendChild(i),[...n,o];if(l&&!d||c&&!u&&!d)return[...n,o,i]}getNodes(e){let n=Array.from(e.childNodes),o,r=(i,s)=>{if(z.isEmpty(s)&&!z.isSingleTag(s))return i;let a=i[i.length-1],l=new DocumentFragment;switch(a&&z.isFragment(a)&&(l=i.pop()),s.nodeType){case Node.ELEMENT_NODE:if(o=this.processElementNode(s,i,l),o)return o;break;case Node.TEXT_NODE:return l.appendChild(s),[...i,l];default:return[...i,l]}return[...i,...Array.from(s.childNodes).reduce(r,[])]};return n.reduce(r,[])}composePasteEvent(e,n){return new CustomEvent(e,{detail:n})}};lk.PATTERN_PROCESSING_MAX_LENGTH=450;var g6=lk,Um=class extends Ie{constructor(){super(...arguments),this.toolsDontSupportReadOnly=[],this.readOnlyEnabled=!1}get isEnabled(){return this.readOnlyEnabled}async prepare(){let{Tools:e}=this.Editor,{blockTools:n}=e,o=[];Array.from(n.entries()).forEach(([r,i])=>{i.isReadOnlySupported||o.push(r)}),this.toolsDontSupportReadOnly=o,this.config.readOnly&&o.length>0&&this.throwCriticalError(),this.toggle(this.config.readOnly,!0)}async toggle(e=!this.readOnlyEnabled,n=!1){e&&this.toolsDontSupportReadOnly.length>0&&this.throwCriticalError();let o=this.readOnlyEnabled;this.readOnlyEnabled=e;for(let i in this.Editor)this.Editor[i].toggleReadOnly&&this.Editor[i].toggleReadOnly(e);if(o===e)return this.readOnlyEnabled;if(n)return this.readOnlyEnabled;this.Editor.ModificationsObserver.disable();let r=await this.Editor.Saver.save();return await this.Editor.BlockManager.clear(),await this.Editor.Renderer.render(r.blocks),this.Editor.ModificationsObserver.enable(),this.readOnlyEnabled}throwCriticalError(){throw new wu(`To enable read-only mode all connected tools should support it. Tools ${this.toolsDontSupportReadOnly.join(", ")} don't support read-only mode.`)}},jm=class t extends Ie{constructor(){super(...arguments),this.isRectSelectionActivated=!1,this.SCROLL_SPEED=3,this.HEIGHT_OF_SCROLL_ZONE=40,this.BOTTOM_SCROLL_ZONE=1,this.TOP_SCROLL_ZONE=2,this.MAIN_MOUSE_BUTTON=0,this.mousedown=!1,this.isScrolling=!1,this.inScrollZone=null,this.startX=0,this.startY=0,this.mouseX=0,this.mouseY=0,this.stackOfSelected=[],this.listenerIds=[]}static get CSS(){return{overlay:"codex-editor-overlay",overlayContainer:"codex-editor-overlay__container",rect:"codex-editor-overlay__rectangle",topScrollZone:"codex-editor-overlay__scroll-zone--top",bottomScrollZone:"codex-editor-overlay__scroll-zone--bottom"}}prepare(){this.enableModuleBindings()}startSelection(e,n){let o=document.elementFromPoint(e-window.pageXOffset,n-window.pageYOffset);o.closest(`.${this.Editor.Toolbar.CSS.toolbar}`)||(this.Editor.BlockSelection.allBlocksSelected=!1,this.clearSelection(),this.stackOfSelected=[]);let r=[`.${go.CSS.content}`,`.${this.Editor.Toolbar.CSS.toolbar}`,`.${this.Editor.InlineToolbar.CSS.inlineToolbar}`],i=o.closest("."+this.Editor.UI.CSS.editorWrapper),s=r.some(a=>!!o.closest(a));!i||s||(this.mousedown=!0,this.startX=e,this.startY=n)}endSelection(){this.mousedown=!1,this.startX=0,this.startY=0,this.overlayRectangle.style.display="none"}isRectActivated(){return this.isRectSelectionActivated}clearSelection(){this.isRectSelectionActivated=!1}enableModuleBindings(){let{container:e}=this.genHTML();this.listeners.on(e,"mousedown",n=>{this.processMouseDown(n)},!1),this.listeners.on(document.body,"mousemove",em(n=>{this.processMouseMove(n)},10),{passive:!0}),this.listeners.on(document.body,"mouseleave",()=>{this.processMouseLeave()}),this.listeners.on(window,"scroll",em(n=>{this.processScroll(n)},10),{passive:!0}),this.listeners.on(document.body,"mouseup",()=>{this.processMouseUp()},!1)}processMouseDown(e){e.button===this.MAIN_MOUSE_BUTTON&&(e.target.closest(z.allInputsSelector)!==null||this.startSelection(e.pageX,e.pageY))}processMouseMove(e){this.changingRectangle(e),this.scrollByZones(e.clientY)}processMouseLeave(){this.clearSelection(),this.endSelection()}processScroll(e){this.changingRectangle(e)}processMouseUp(){this.clearSelection(),this.endSelection()}scrollByZones(e){if(this.inScrollZone=null,e<=this.HEIGHT_OF_SCROLL_ZONE&&(this.inScrollZone=this.TOP_SCROLL_ZONE),document.documentElement.clientHeight-e<=this.HEIGHT_OF_SCROLL_ZONE&&(this.inScrollZone=this.BOTTOM_SCROLL_ZONE),!this.inScrollZone){this.isScrolling=!1;return}this.isScrolling||(this.scrollVertical(this.inScrollZone===this.TOP_SCROLL_ZONE?-this.SCROLL_SPEED:this.SCROLL_SPEED),this.isScrolling=!0)}genHTML(){let{UI:e}=this.Editor,n=e.nodes.holder.querySelector("."+e.CSS.editorWrapper),o=z.make("div",t.CSS.overlay,{}),r=z.make("div",t.CSS.overlayContainer,{}),i=z.make("div",t.CSS.rect,{});return r.appendChild(i),o.appendChild(r),n.appendChild(o),this.overlayRectangle=i,{container:n,overlay:o}}scrollVertical(e){if(!(this.inScrollZone&&this.mousedown))return;let n=window.pageYOffset;window.scrollBy(0,e),this.mouseY+=window.pageYOffset-n,setTimeout(()=>{this.scrollVertical(e)},0)}changingRectangle(e){if(!this.mousedown)return;e.pageY!==void 0&&(this.mouseX=e.pageX,this.mouseY=e.pageY);let{rightPos:n,leftPos:o,index:r}=this.genInfoForMouseSelection(),i=this.startX>n&&this.mouseX>n,s=this.startX<o&&this.mouseX<o;this.rectCrossesBlocks=!(i||s),this.isRectSelectionActivated||(this.rectCrossesBlocks=!1,this.isRectSelectionActivated=!0,this.shrinkRectangleToPoint(),this.overlayRectangle.style.display="block"),this.updateRectangleSize(),this.Editor.Toolbar.close(),r!==void 0&&(this.trySelectNextBlock(r),this.inverseSelection(),ge.get().removeAllRanges())}shrinkRectangleToPoint(){this.overlayRectangle.style.left=`${this.startX-window.pageXOffset}px`,this.overlayRectangle.style.top=`${this.startY-window.pageYOffset}px`,this.overlayRectangle.style.bottom=`calc(100% - ${this.startY-window.pageYOffset}px`,this.overlayRectangle.style.right=`calc(100% - ${this.startX-window.pageXOffset}px`}inverseSelection(){let e=this.Editor.BlockManager.getBlockByIndex(this.stackOfSelected[0]).selected;if(this.rectCrossesBlocks&&!e)for(let n of this.stackOfSelected)this.Editor.BlockSelection.selectBlockByIndex(n);if(!this.rectCrossesBlocks&&e)for(let n of this.stackOfSelected)this.Editor.BlockSelection.unSelectBlockByIndex(n)}updateRectangleSize(){this.mouseY>=this.startY?(this.overlayRectangle.style.top=`${this.startY-window.pageYOffset}px`,this.overlayRectangle.style.bottom=`calc(100% - ${this.mouseY-window.pageYOffset}px`):(this.overlayRectangle.style.bottom=`calc(100% - ${this.startY-window.pageYOffset}px`,this.overlayRectangle.style.top=`${this.mouseY-window.pageYOffset}px`),this.mouseX>=this.startX?(this.overlayRectangle.style.left=`${this.startX-window.pageXOffset}px`,this.overlayRectangle.style.right=`calc(100% - ${this.mouseX-window.pageXOffset}px`):(this.overlayRectangle.style.right=`calc(100% - ${this.startX-window.pageXOffset}px`,this.overlayRectangle.style.left=`${this.mouseX-window.pageXOffset}px`)}genInfoForMouseSelection(){let e=document.body.offsetWidth/2,n=this.mouseY-window.pageYOffset,o=document.elementFromPoint(e,n),r=this.Editor.BlockManager.getBlockByChildNode(o),i;r!==void 0&&(i=this.Editor.BlockManager.blocks.findIndex(d=>d.holder===r.holder));let s=this.Editor.BlockManager.lastBlock.holder.querySelector("."+go.CSS.content),a=Number.parseInt(window.getComputedStyle(s).width,10)/2,l=e-a,c=e+a;return{index:i,leftPos:l,rightPos:c}}addBlockInSelection(e){this.rectCrossesBlocks&&this.Editor.BlockSelection.selectBlockByIndex(e),this.stackOfSelected.push(e)}trySelectNextBlock(e){let n=this.stackOfSelected[this.stackOfSelected.length-1]===e,o=this.stackOfSelected.length,r=1,i=-1,s=0;if(n)return;let a=this.stackOfSelected[o-1]-this.stackOfSelected[o-2]>0,l=s;o>1&&(l=a?r:i);let c=e>this.stackOfSelected[o-1]&&l===r,d=e<this.stackOfSelected[o-1]&&l===i,u=!(c||d||l===s);if(!u&&(e>this.stackOfSelected[o-1]||this.stackOfSelected[o-1]===void 0)){let h=this.stackOfSelected[o-1]+1||e;for(h;h<=e;h++)this.addBlockInSelection(h);return}if(!u&&e<this.stackOfSelected[o-1]){for(let h=this.stackOfSelected[o-1]-1;h>=e;h--)this.addBlockInSelection(h);return}if(!u)return;let p=o-1,f;for(e>this.stackOfSelected[o-1]?f=()=>e>this.stackOfSelected[p]:f=()=>e<this.stackOfSelected[p];f();)this.rectCrossesBlocks&&this.Editor.BlockSelection.unSelectBlockByIndex(this.stackOfSelected[p]),this.stackOfSelected.pop(),p--}},Vm=class extends Ie{async render(e){return new Promise(n=>{let{Tools:o,BlockManager:r}=this.Editor;if(e.length===0)r.insert();else{let i=e.map(({type:s,data:a,tunes:l,id:c})=>{o.available.has(s)===!1&&(ao(`Tool \xAB${s}\xBB is not found. Check 'tools' property at the Editor.js config.`,"warn"),a=this.composeStubDataForTool(s,a,c),s=o.stubTool);let d;try{d=r.composeBlock({id:c,tool:s,data:a,tunes:l})}catch(u){Ue(`Block \xAB${s}\xBB skipped because of plugins error`,"error",{data:a,error:u}),a=this.composeStubDataForTool(s,a,c),s=o.stubTool,d=r.composeBlock({id:c,tool:s,data:a,tunes:l})}return d});r.insertMany(i)}window.requestIdleCallback(()=>{n()},{timeout:2e3})})}composeStubDataForTool(e,n,o){let{Tools:r}=this.Editor,i=e;if(r.unavailable.has(e)){let s=r.unavailable.get(e).toolbox;s!==void 0&&s[0].title!==void 0&&(i=s[0].title)}return{savedData:{id:o,type:e,data:n},title:i}}},Wm=class extends Ie{async save(){let{BlockManager:e,Tools:n}=this.Editor,o=e.blocks,r=[];try{o.forEach(a=>{r.push(this.getSavedData(a))});let i=await Promise.all(r),s=await e_(i,a=>n.blockTools.get(a).sanitizeConfig);return this.makeOutput(s)}catch(i){ao("Saving failed due to the Error %o","error",i)}}async getSavedData(e){let n=await e.save(),o=n&&await e.validate(n.data);return{...n,isValid:o}}makeOutput(e){let n=[];return e.forEach(({id:o,tool:r,data:i,tunes:s,isValid:a})=>{if(!a){Ue(`Block \xAB${r}\xBB skipped because saved data is invalid`);return}if(r===this.Editor.Tools.stubTool){n.push(i);return}let l={id:o,type:r,data:i,...!lo(s)&&{tunes:s}};n.push(l)}),{time:+new Date,blocks:n,version:"2.31.0-rc.7"}}};(function(){try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode(".ce-paragraph{line-height:1.6em;outline:none}.ce-block:only-of-type .ce-paragraph[data-placeholder-active]:empty:before,.ce-block:only-of-type .ce-paragraph[data-placeholder-active][data-empty=true]:before{content:attr(data-placeholder-active)}.ce-paragraph p:first-of-type{margin-top:0}.ce-paragraph p:last-of-type{margin-bottom:0}")),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();var m6='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M8 9V7.2C8 7.08954 8.08954 7 8.2 7L12 7M16 9V7.2C16 7.08954 15.9105 7 15.8 7L12 7M12 7L12 17M12 17H10M12 17H14"/></svg>';function _6(t){let e=document.createElement("div");e.innerHTML=t.trim();let n=document.createDocumentFragment();return n.append(...Array.from(e.childNodes)),n}var Gm=class t{static get DEFAULT_PLACEHOLDER(){return""}constructor({data:e,config:n,api:o,readOnly:r}){this.api=o,this.readOnly=r,this._CSS={block:this.api.styles.block,wrapper:"ce-paragraph"},this.readOnly||(this.onKeyUp=this.onKeyUp.bind(this)),this._placeholder=n.placeholder?n.placeholder:t.DEFAULT_PLACEHOLDER,this._data=e??{},this._element=null,this._preserveBlank=n.preserveBlank??!1}onKeyUp(e){if(e.code!=="Backspace"&&e.code!=="Delete"||!this._element)return;let{textContent:n}=this._element;n===""&&(this._element.innerHTML="")}drawView(){let e=document.createElement("DIV");return e.classList.add(this._CSS.wrapper,this._CSS.block),e.contentEditable="false",e.dataset.placeholderActive=this.api.i18n.t(this._placeholder),this._data.text&&(e.innerHTML=this._data.text),this.readOnly||(e.contentEditable="true",e.addEventListener("keyup",this.onKeyUp)),e}render(){return this._element=this.drawView(),this._element}merge(e){if(!this._element)return;this._data.text+=e.text;let n=_6(e.text);this._element.appendChild(n),this._element.normalize()}validate(e){return!(e.text.trim()===""&&!this._preserveBlank)}save(e){return{text:e.innerHTML}}onPaste(e){let n={text:e.detail.data.innerHTML};this._data=n,window.requestAnimationFrame(()=>{this._element&&(this._element.innerHTML=this._data.text||"")})}static get conversionConfig(){return{export:"text",import:"text"}}static get sanitize(){return{text:{br:!0}}}static get isReadOnlySupported(){return!0}static get pasteConfig(){return{tags:["P"]}}static get toolbox(){return{icon:m6,title:"Text"}}},rc=class{constructor(){this.commandName="bold"}static get sanitize(){return{b:{}}}render(){return{icon:d4,name:"bold",onActivate:()=>{document.execCommand(this.commandName)},isActive:()=>document.queryCommandState(this.commandName)}}get shortcut(){return"CMD+B"}};rc.isInline=!0;rc.title="Bold";var ic=class{constructor(){this.commandName="italic",this.CSS={button:"ce-inline-tool",buttonActive:"ce-inline-tool--active",buttonModifier:"ce-inline-tool--italic"},this.nodes={button:null}}static get sanitize(){return{i:{}}}render(){return this.nodes.button=document.createElement("button"),this.nodes.button.type="button",this.nodes.button.classList.add(this.CSS.button,this.CSS.buttonModifier),this.nodes.button.innerHTML=_4,this.nodes.button}surround(){document.execCommand(this.commandName)}checkState(){let e=document.queryCommandState(this.commandName);return this.nodes.button.classList.toggle(this.CSS.buttonActive,e),e}get shortcut(){return"CMD+I"}};ic.isInline=!0;ic.title="Italic";var sc=class{constructor({api:e}){this.commandLink="createLink",this.commandUnlink="unlink",this.ENTER_KEY=13,this.CSS={button:"ce-inline-tool",buttonActive:"ce-inline-tool--active",buttonModifier:"ce-inline-tool--link",buttonUnlink:"ce-inline-tool--unlink",input:"ce-inline-tool-input",inputShowed:"ce-inline-tool-input--showed"},this.nodes={button:null,input:null},this.inputOpened=!1,this.toolbar=e.toolbar,this.inlineToolbar=e.inlineToolbar,this.notifier=e.notifier,this.i18n=e.i18n,this.selection=new ge}static get sanitize(){return{a:{href:!0,target:"_blank",rel:"nofollow"}}}render(){return this.nodes.button=document.createElement("button"),this.nodes.button.type="button",this.nodes.button.classList.add(this.CSS.button,this.CSS.buttonModifier),this.nodes.button.innerHTML=nS,this.nodes.button}renderActions(){return this.nodes.input=document.createElement("input"),this.nodes.input.placeholder=this.i18n.t("Add a link"),this.nodes.input.enterKeyHint="done",this.nodes.input.classList.add(this.CSS.input),this.nodes.input.addEventListener("keydown",e=>{e.keyCode===this.ENTER_KEY&&this.enterPressed(e)}),this.nodes.input}surround(e){if(e){this.inputOpened?(this.selection.restore(),this.selection.removeFakeBackground()):(this.selection.setFakeBackground(),this.selection.save());let n=this.selection.findParentTag("A");if(n){this.selection.expandToTag(n),this.unlink(),this.closeActions(),this.checkState(),this.toolbar.close();return}}this.toggleActions()}checkState(){let e=this.selection.findParentTag("A");if(e){this.nodes.button.innerHTML=v4,this.nodes.button.classList.add(this.CSS.buttonUnlink),this.nodes.button.classList.add(this.CSS.buttonActive),this.openActions();let n=e.getAttribute("href");this.nodes.input.value=n!=="null"?n:"",this.selection.save()}else this.nodes.button.innerHTML=nS,this.nodes.button.classList.remove(this.CSS.buttonUnlink),this.nodes.button.classList.remove(this.CSS.buttonActive);return!!e}clear(){this.closeActions()}get shortcut(){return"CMD+K"}toggleActions(){this.inputOpened?this.closeActions(!1):this.openActions(!0)}openActions(e=!1){this.nodes.input.classList.add(this.CSS.inputShowed),e&&this.nodes.input.focus(),this.inputOpened=!0}closeActions(e=!0){if(this.selection.isFakeBackgroundEnabled){let n=new ge;n.save(),this.selection.restore(),this.selection.removeFakeBackground(),n.restore()}this.nodes.input.classList.remove(this.CSS.inputShowed),this.nodes.input.value="",e&&this.selection.clearSaved(),this.inputOpened=!1}enterPressed(e){let n=this.nodes.input.value||"";if(!n.trim()){this.selection.restore(),this.unlink(),e.preventDefault(),this.closeActions();return}if(!this.validateURL(n)){this.notifier.show({message:"Pasted link is not valid.",style:"error"}),Ue("Incorrect Link pasted","warn",n);return}n=this.prepareLink(n),this.selection.restore(),this.selection.removeFakeBackground(),this.insertLink(n),e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),this.selection.collapseToEnd(),this.inlineToolbar.close()}validateURL(e){return!/\s/.test(e)}prepareLink(e){return e=e.trim(),e=this.addProtocol(e),e}addProtocol(e){if(/^(\w+):(\/\/)?/.test(e))return e;let n=/^\/[^/\s]/.test(e),o=e.substring(0,1)==="#",r=/^\/\/[^/\s]/.test(e);return!n&&!o&&!r&&(e="http://"+e),e}insertLink(e){let n=this.selection.findParentTag("A");n&&this.selection.expandToTag(n),document.execCommand(this.commandLink,!1,e)}unlink(){document.execCommand(this.commandUnlink)}};sc.isInline=!0;sc.title="Link";var Au=class{constructor({api:e}){this.i18nAPI=e.i18n,this.blocksAPI=e.blocks,this.selectionAPI=e.selection,this.toolsAPI=e.tools,this.caretAPI=e.caret}async render(){let e=ge.get(),n=this.blocksAPI.getBlockByElement(e.anchorNode);if(n===void 0)return[];let o=this.toolsAPI.getBlockTools(),r=await vS(n,o);if(r.length===0)return[];let i=r.reduce((c,d)=>{var u;return(u=d.toolbox)==null||u.forEach(p=>{c.push({icon:p.icon,title:mn.t(Gn.toolNames,p.title),name:d.name,closeOnActivate:!0,onActivate:async()=>{let f=await this.blocksAPI.convert(n.id,d.name,p.data);this.caretAPI.setToBlock(f,"end")}})}),c},[]),s=await n.getActiveToolboxEntry(),a=s!==void 0?s.icon:kS,l=!ba();return{icon:a,name:"convert-to",hint:{title:this.i18nAPI.t("Convert to")},children:{searchable:l,items:i,onOpen:()=>{l&&(this.selectionAPI.setFakeBackground(),this.selectionAPI.save())},onClose:()=>{l&&(this.selectionAPI.restore(),this.selectionAPI.removeFakeBackground())}}}}};Au.isInline=!0;var Lu=class{constructor({data:e,api:n}){this.CSS={wrapper:"ce-stub",info:"ce-stub__info",title:"ce-stub__title",subtitle:"ce-stub__subtitle"},this.api=n,this.title=e.title||this.api.i18n.t("Error"),this.subtitle=this.api.i18n.t("The block can not be displayed correctly."),this.savedData=e.savedData,this.wrapper=this.make()}render(){return this.wrapper}save(){return this.savedData}make(){let e=z.make("div",this.CSS.wrapper),n=C4,o=z.make("div",this.CSS.info),r=z.make("div",this.CSS.title,{textContent:this.title}),i=z.make("div",this.CSS.subtitle,{textContent:this.subtitle});return e.innerHTML=n,o.appendChild(r),o.appendChild(i),e.appendChild(o),e}};Lu.isReadOnlySupported=!0;var Ym=class extends oc{constructor(){super(...arguments),this.type=Xi.Inline}get title(){return this.constructable[Mu.Title]}create(){return new this.constructable({api:this.api,config:this.settings})}get isReadOnlySupported(){return this.constructable[Mu.IsReadOnlySupported]??!1}},qm=class extends oc{constructor(){super(...arguments),this.type=Xi.Tune}create(e,n){return new this.constructable({api:this.api,config:this.settings,block:n,data:e})}},so=class t extends Map{get blockTools(){let e=Array.from(this.entries()).filter(([,n])=>n.isBlock());return new t(e)}get inlineTools(){let e=Array.from(this.entries()).filter(([,n])=>n.isInline());return new t(e)}get blockTunes(){let e=Array.from(this.entries()).filter(([,n])=>n.isTune());return new t(e)}get internalTools(){let e=Array.from(this.entries()).filter(([,n])=>n.isInternal);return new t(e)}get externalTools(){let e=Array.from(this.entries()).filter(([,n])=>!n.isInternal);return new t(e)}},b6=Object.defineProperty,y6=Object.getOwnPropertyDescriptor,dk=(t,e,n,o)=>{for(var r=o>1?void 0:o?y6(e,n):e,i=t.length-1,s;i>=0;i--)(s=t[i])&&(r=(o?s(e,n,r):s(r))||r);return o&&r&&b6(e,n,r),r},ac=class extends oc{constructor(){super(...arguments),this.type=Xi.Block,this.inlineTools=new so,this.tunes=new so}create(e,n,o){return new this.constructable({data:e,block:n,readOnly:o,api:this.api,config:this.settings})}get isReadOnlySupported(){return this.constructable[fa.IsReadOnlySupported]===!0}get isLineBreaksEnabled(){return this.constructable[fa.IsEnabledLineBreaks]}get toolbox(){let e=this.constructable[fa.Toolbox],n=this.config[bu.Toolbox];if(!lo(e)&&n!==!1)return n?Array.isArray(e)?Array.isArray(n)?n.map((o,r)=>{let i=e[r];return i?{...i,...o}:o}):[n]:Array.isArray(n)?n:[{...e,...n}]:Array.isArray(e)?e:[e]}get conversionConfig(){return this.constructable[fa.ConversionConfig]}get enabledInlineTools(){return this.config[bu.EnabledInlineTools]||!1}get enabledBlockTunes(){return this.config[bu.EnabledBlockTunes]}get pasteConfig(){return this.constructable[fa.PasteConfig]??{}}get sanitizeConfig(){let e=super.sanitizeConfig,n=this.baseSanitizeConfig;if(lo(e))return n;let o={};for(let r in e)if(Object.prototype.hasOwnProperty.call(e,r)){let i=e[r];nn(i)?o[r]=Object.assign({},n,i):o[r]=i}return o}get baseSanitizeConfig(){let e={};return Array.from(this.inlineTools.values()).forEach(n=>Object.assign(e,n.sanitizeConfig)),Array.from(this.tunes.values()).forEach(n=>Object.assign(e,n.sanitizeConfig)),e}};dk([_a],ac.prototype,"sanitizeConfig",1);dk([_a],ac.prototype,"baseSanitizeConfig",1);var Jm=class{constructor(e,n,o){this.api=o,this.config=e,this.editorConfig=n}get(e){let{class:n,isInternal:o=!1,...r}=this.config[e],i=this.getConstructor(n),s=n[Mm.IsTune];return new i({name:e,constructable:n,config:r,api:this.api.getMethodsForTool(e,s),isDefault:e===this.editorConfig.defaultBlock,defaultPlaceholder:this.editorConfig.placeholder,isInternal:o})}getConstructor(e){switch(!0){case e[Mu.IsInline]:return Ym;case e[Mm.IsTune]:return qm;default:return ac}}},Ru=class{constructor({api:e}){this.CSS={animation:"wobble"},this.api=e}render(){return{icon:u4,title:this.api.i18n.t("Move down"),onActivate:()=>this.handleClick(),name:"move-down"}}handleClick(){let e=this.api.blocks.getCurrentBlockIndex(),n=this.api.blocks.getBlockByIndex(e+1);if(!n)throw new Error("Unable to move Block down since it is already the last");let o=n.holder,r=o.getBoundingClientRect(),i=Math.abs(window.innerHeight-o.offsetHeight);r.top<window.innerHeight&&(i=window.scrollY+o.offsetHeight),window.scrollTo(0,i),this.api.blocks.move(e+1),this.api.toolbar.toggleBlockSettings(!0)}};Ru.isTune=!0;var Pu=class{constructor({api:e}){this.api=e}render(){return{icon:g4,title:this.api.i18n.t("Delete"),name:"delete",confirmation:{title:this.api.i18n.t("Click to delete"),onActivate:()=>this.handleClick()}}}handleClick(){this.api.blocks.delete()}};Pu.isTune=!0;var Fu=class{constructor({api:e}){this.CSS={animation:"wobble"},this.api=e}render(){return{icon:h4,title:this.api.i18n.t("Move up"),onActivate:()=>this.handleClick(),name:"move-up"}}handleClick(){let e=this.api.blocks.getCurrentBlockIndex(),n=this.api.blocks.getBlockByIndex(e),o=this.api.blocks.getBlockByIndex(e-1);if(e===0||!n||!o)throw new Error("Unable to move Block up since it is already the first");let r=n.holder,i=o.holder,s=r.getBoundingClientRect(),a=i.getBoundingClientRect(),l;a.top>0?l=Math.abs(s.top)-Math.abs(a.top):l=Math.abs(s.top)+a.height,window.scrollBy(0,-1*l),this.api.blocks.move(e-1),this.api.toolbar.toggleBlockSettings(!0)}};Fu.isTune=!0;var x6=Object.defineProperty,v6=Object.getOwnPropertyDescriptor,C6=(t,e,n,o)=>{for(var r=o>1?void 0:o?v6(e,n):e,i=t.length-1,s;i>=0;i--)(s=t[i])&&(r=(o?s(e,n,r):s(r))||r);return o&&r&&x6(e,n,r),r},Bu=class extends Ie{constructor(){super(...arguments),this.stubTool="stub",this.toolsAvailable=new so,this.toolsUnavailable=new so}get available(){return this.toolsAvailable}get unavailable(){return this.toolsUnavailable}get inlineTools(){return this.available.inlineTools}get blockTools(){return this.available.blockTools}get blockTunes(){return this.available.blockTunes}get defaultTool(){return this.blockTools.get(this.config.defaultBlock)}get internal(){return this.available.internalTools}async prepare(){if(this.validateTools(),this.config.tools=tm({},this.internalTools,this.config.tools),!Object.prototype.hasOwnProperty.call(this.config,"tools")||Object.keys(this.config.tools).length===0)throw Error("Can't start without tools");let e=this.prepareConfig();this.factory=new Jm(e,this.config,this.Editor.API);let n=this.getListOfPrepareFunctions(e);if(n.length===0)return Promise.resolve();await AH(n,o=>{this.toolPrepareMethodSuccess(o)},o=>{this.toolPrepareMethodFallback(o)}),this.prepareBlockTools()}getAllInlineToolsSanitizeConfig(){let e={};return Array.from(this.inlineTools.values()).forEach(n=>{Object.assign(e,n.sanitizeConfig)}),e}destroy(){Object.values(this.available).forEach(async e=>{lt(e.reset)&&await e.reset()})}get internalTools(){return{convertTo:{class:Au,isInternal:!0},link:{class:sc,isInternal:!0},bold:{class:rc,isInternal:!0},italic:{class:ic,isInternal:!0},paragraph:{class:Gm,inlineToolbar:!0,isInternal:!0},stub:{class:Lu,isInternal:!0},moveUp:{class:Fu,isInternal:!0},delete:{class:Pu,isInternal:!0},moveDown:{class:Ru,isInternal:!0}}}toolPrepareMethodSuccess(e){let n=this.factory.get(e.toolName);if(n.isInline()){let o=["render"].filter(r=>!n.create()[r]);if(o.length){Ue(`Incorrect Inline Tool: ${n.name}. Some of required methods is not implemented %o`,"warn",o),this.toolsUnavailable.set(n.name,n);return}}this.toolsAvailable.set(n.name,n)}toolPrepareMethodFallback(e){this.toolsUnavailable.set(e.toolName,this.factory.get(e.toolName))}getListOfPrepareFunctions(e){let n=[];return Object.entries(e).forEach(([o,r])=>{n.push({function:lt(r.class.prepare)?r.class.prepare:()=>{},data:{toolName:o,config:r.config}})}),n}prepareBlockTools(){Array.from(this.blockTools.values()).forEach(e=>{this.assignInlineToolsToBlockTool(e),this.assignBlockTunesToBlockTool(e)})}assignInlineToolsToBlockTool(e){if(this.config.inlineToolbar!==!1){if(e.enabledInlineTools===!0){e.inlineTools=new so(Array.isArray(this.config.inlineToolbar)?this.config.inlineToolbar.map(n=>[n,this.inlineTools.get(n)]):Array.from(this.inlineTools.entries()));return}Array.isArray(e.enabledInlineTools)&&(e.inlineTools=new so(["convertTo",...e.enabledInlineTools].map(n=>[n,this.inlineTools.get(n)])))}}assignBlockTunesToBlockTool(e){if(e.enabledBlockTunes!==!1){if(Array.isArray(e.enabledBlockTunes)){let n=new so(e.enabledBlockTunes.map(o=>[o,this.blockTunes.get(o)]));e.tunes=new so([...n,...this.blockTunes.internalTools]);return}if(Array.isArray(this.config.tunes)){let n=new so(this.config.tunes.map(o=>[o,this.blockTunes.get(o)]));e.tunes=new so([...n,...this.blockTunes.internalTools]);return}e.tunes=this.blockTunes.internalTools}}validateTools(){for(let e in this.config.tools)if(Object.prototype.hasOwnProperty.call(this.config.tools,e)){if(e in this.internalTools)return;let n=this.config.tools[e];if(!lt(n)&&!lt(n.class))throw Error(`Tool \xAB${e}\xBB must be a constructor function or an object with function in the \xABclass\xBB property`)}}prepareConfig(){let e={};for(let n in this.config.tools)nn(this.config.tools[n])?e[n]=this.config.tools[n]:e[n]={class:this.config.tools[n]};return e}};C6([_a],Bu.prototype,"getAllInlineToolsSanitizeConfig",1);var E6=`:root{--selectionColor: #e1f2ff;--inlineSelectionColor: #d4ecff;--bg-light: #eff2f5;--grayText: #707684;--color-dark: #1D202B;--color-active-icon: #388AE5;--color-gray-border: rgba(201, 201, 204, .48);--content-width: 650px;--narrow-mode-right-padding: 50px;--toolbox-buttons-size: 26px;--toolbox-buttons-size--mobile: 36px;--icon-size: 20px;--icon-size--mobile: 28px;--block-padding-vertical: .4em;--color-line-gray: #EFF0F1 }.codex-editor{position:relative;-webkit-box-sizing:border-box;box-sizing:border-box;z-index:1}.codex-editor .hide{display:none}.codex-editor__redactor [contenteditable]:empty:after{content:"\\feff"}@media (min-width: 651px){.codex-editor--narrow .codex-editor__redactor{margin-right:50px}}@media (min-width: 651px){.codex-editor--narrow.codex-editor--rtl .codex-editor__redactor{margin-left:50px;margin-right:0}}@media (min-width: 651px){.codex-editor--narrow .ce-toolbar__actions{right:-5px}}.codex-editor-copyable{position:absolute;height:1px;width:1px;top:-400%;opacity:.001}.codex-editor-overlay{position:fixed;top:0;left:0;right:0;bottom:0;z-index:999;pointer-events:none;overflow:hidden}.codex-editor-overlay__container{position:relative;pointer-events:auto;z-index:0}.codex-editor-overlay__rectangle{position:absolute;pointer-events:none;background-color:#2eaadc33;border:1px solid transparent}.codex-editor svg{max-height:100%}.codex-editor path{stroke:currentColor}.codex-editor ::-moz-selection{background-color:#d4ecff}.codex-editor ::selection{background-color:#d4ecff}.codex-editor--toolbox-opened [contentEditable=true][data-placeholder]:focus:before{opacity:0!important}.ce-scroll-locked{overflow:hidden}.ce-scroll-locked--hard{overflow:hidden;top:calc(-1 * var(--window-scroll-offset));position:fixed;width:100%}.ce-toolbar{position:absolute;left:0;right:0;top:0;-webkit-transition:opacity .1s ease;transition:opacity .1s ease;will-change:opacity,top;display:none}.ce-toolbar--opened{display:block}.ce-toolbar__content{max-width:650px;margin:0 auto;position:relative}.ce-toolbar__plus{color:#1d202b;cursor:pointer;width:26px;height:26px;border-radius:7px;display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-ms-flex-negative:0;flex-shrink:0}@media (max-width: 650px){.ce-toolbar__plus{width:36px;height:36px}}@media (hover: hover){.ce-toolbar__plus:hover{background-color:#eff2f5}}.ce-toolbar__plus--active{background-color:#eff2f5;-webkit-animation:bounceIn .75s 1;animation:bounceIn .75s 1;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards}.ce-toolbar__plus-shortcut{opacity:.6;word-spacing:-2px;margin-top:5px}@media (max-width: 650px){.ce-toolbar__plus{position:absolute;background-color:#fff;border:1px solid #E8E8EB;-webkit-box-shadow:0 3px 15px -3px rgba(13,20,33,.13);box-shadow:0 3px 15px -3px #0d142121;border-radius:6px;z-index:2;position:static}.ce-toolbar__plus--left-oriented:before{left:15px;margin-left:0}.ce-toolbar__plus--right-oriented:before{left:auto;right:15px;margin-left:0}}.ce-toolbar__actions{position:absolute;right:100%;opacity:0;display:-webkit-box;display:-ms-flexbox;display:flex;padding-right:5px}.ce-toolbar__actions--opened{opacity:1}@media (max-width: 650px){.ce-toolbar__actions{right:auto}}.ce-toolbar__settings-btn{color:#1d202b;width:26px;height:26px;border-radius:7px;display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;margin-left:3px;cursor:pointer;user-select:none}@media (max-width: 650px){.ce-toolbar__settings-btn{width:36px;height:36px}}@media (hover: hover){.ce-toolbar__settings-btn:hover{background-color:#eff2f5}}.ce-toolbar__settings-btn--active{background-color:#eff2f5;-webkit-animation:bounceIn .75s 1;animation:bounceIn .75s 1;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards}@media (min-width: 651px){.ce-toolbar__settings-btn{width:24px}}.ce-toolbar__settings-btn--hidden{display:none}@media (max-width: 650px){.ce-toolbar__settings-btn{position:absolute;background-color:#fff;border:1px solid #E8E8EB;-webkit-box-shadow:0 3px 15px -3px rgba(13,20,33,.13);box-shadow:0 3px 15px -3px #0d142121;border-radius:6px;z-index:2;position:static}.ce-toolbar__settings-btn--left-oriented:before{left:15px;margin-left:0}.ce-toolbar__settings-btn--right-oriented:before{left:auto;right:15px;margin-left:0}}.ce-toolbar__plus svg,.ce-toolbar__settings-btn svg{width:24px;height:24px}@media (min-width: 651px){.codex-editor--narrow .ce-toolbar__plus{left:5px}}@media (min-width: 651px){.codex-editor--narrow .ce-toolbox .ce-popover{right:0;left:auto;left:initial}}.ce-inline-toolbar{--y-offset: 8px;--color-background-icon-active: rgba(56, 138, 229, .1);--color-text-icon-active: #388AE5;--color-text-primary: black;position:absolute;visibility:hidden;-webkit-transition:opacity .25s ease;transition:opacity .25s ease;will-change:opacity,left,top;top:0;left:0;z-index:3;opacity:1;visibility:visible}.ce-inline-toolbar [hidden]{display:none!important}.ce-inline-toolbar__toggler-and-button-wrapper{display:-webkit-box;display:-ms-flexbox;display:flex;width:100%;padding:0 6px}.ce-inline-toolbar__buttons{display:-webkit-box;display:-ms-flexbox;display:flex}.ce-inline-toolbar__dropdown{display:-webkit-box;display:-ms-flexbox;display:flex;padding:6px;margin:0 6px 0 -6px;-webkit-box-align:center;-ms-flex-align:center;align-items:center;cursor:pointer;border-right:1px solid rgba(201,201,204,.48);-webkit-box-sizing:border-box;box-sizing:border-box}@media (hover: hover){.ce-inline-toolbar__dropdown:hover{background:#eff2f5}}.ce-inline-toolbar__dropdown--hidden{display:none}.ce-inline-toolbar__dropdown-content,.ce-inline-toolbar__dropdown-arrow{display:-webkit-box;display:-ms-flexbox;display:flex}.ce-inline-toolbar__dropdown-content svg,.ce-inline-toolbar__dropdown-arrow svg{width:20px;height:20px}.ce-inline-toolbar__shortcut{opacity:.6;word-spacing:-3px;margin-top:3px}.ce-inline-tool{color:var(--color-text-primary);display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;border:0;border-radius:4px;line-height:normal;height:100%;padding:0;width:28px;background-color:transparent;cursor:pointer}@media (max-width: 650px){.ce-inline-tool{width:36px;height:36px}}@media (hover: hover){.ce-inline-tool:hover{background-color:#f8f8f8}}.ce-inline-tool svg{display:block;width:20px;height:20px}@media (max-width: 650px){.ce-inline-tool svg{width:28px;height:28px}}.ce-inline-tool--link .icon--unlink,.ce-inline-tool--unlink .icon--link{display:none}.ce-inline-tool--unlink .icon--unlink{display:inline-block;margin-bottom:-1px}.ce-inline-tool-input{background:#F8F8F8;border:1px solid rgba(226,226,229,.2);border-radius:6px;padding:4px 8px;font-size:14px;line-height:22px;outline:none;margin:0;width:100%;-webkit-box-sizing:border-box;box-sizing:border-box;display:none;font-weight:500;-webkit-appearance:none;font-family:inherit}@media (max-width: 650px){.ce-inline-tool-input{font-size:15px;font-weight:500}}.ce-inline-tool-input::-webkit-input-placeholder{color:#707684}.ce-inline-tool-input::-moz-placeholder{color:#707684}.ce-inline-tool-input:-ms-input-placeholder{color:#707684}.ce-inline-tool-input::-ms-input-placeholder{color:#707684}.ce-inline-tool-input::placeholder{color:#707684}.ce-inline-tool-input--showed{display:block}.ce-inline-tool--active{background:var(--color-background-icon-active);color:var(--color-text-icon-active)}@-webkit-keyframes fade-in{0%{opacity:0}to{opacity:1}}@keyframes fade-in{0%{opacity:0}to{opacity:1}}.ce-block{-webkit-animation:fade-in .3s ease;animation:fade-in .3s ease;-webkit-animation-fill-mode:none;animation-fill-mode:none;-webkit-animation-fill-mode:initial;animation-fill-mode:initial}.ce-block:first-of-type{margin-top:0}.ce-block--selected .ce-block__content{background:#e1f2ff}.ce-block--selected .ce-block__content [contenteditable]{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.ce-block--selected .ce-block__content img,.ce-block--selected .ce-block__content .ce-stub{opacity:.55}.ce-block--stretched .ce-block__content{max-width:none}.ce-block__content{position:relative;max-width:650px;margin:0 auto;-webkit-transition:background-color .15s ease;transition:background-color .15s ease}.ce-block--drop-target .ce-block__content:before{content:"";position:absolute;top:100%;left:-20px;margin-top:-1px;height:8px;width:8px;border:solid #388AE5;border-width:1px 1px 0 0;-webkit-transform-origin:right;transform-origin:right;-webkit-transform:rotate(45deg);transform:rotate(45deg)}.ce-block--drop-target .ce-block__content:after{content:"";position:absolute;top:100%;height:1px;width:100%;color:#388ae5;background:repeating-linear-gradient(90deg,#388AE5,#388AE5 1px,#fff 1px,#fff 6px)}.ce-block a{cursor:pointer;-webkit-text-decoration:underline;text-decoration:underline}.ce-block b{font-weight:700}.ce-block i{font-style:italic}@-webkit-keyframes bounceIn{0%,20%,40%,60%,80%,to{-webkit-animation-timing-function:cubic-bezier(.215,.61,.355,1);animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{-webkit-transform:scale3d(.9,.9,.9);transform:scale3d(.9,.9,.9)}20%{-webkit-transform:scale3d(1.03,1.03,1.03);transform:scale3d(1.03,1.03,1.03)}60%{-webkit-transform:scale3d(1,1,1);transform:scaleZ(1)}}@keyframes bounceIn{0%,20%,40%,60%,80%,to{-webkit-animation-timing-function:cubic-bezier(.215,.61,.355,1);animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{-webkit-transform:scale3d(.9,.9,.9);transform:scale3d(.9,.9,.9)}20%{-webkit-transform:scale3d(1.03,1.03,1.03);transform:scale3d(1.03,1.03,1.03)}60%{-webkit-transform:scale3d(1,1,1);transform:scaleZ(1)}}@-webkit-keyframes selectionBounce{0%,20%,40%,60%,80%,to{-webkit-animation-timing-function:cubic-bezier(.215,.61,.355,1);animation-timing-function:cubic-bezier(.215,.61,.355,1)}50%{-webkit-transform:scale3d(1.01,1.01,1.01);transform:scale3d(1.01,1.01,1.01)}70%{-webkit-transform:scale3d(1,1,1);transform:scaleZ(1)}}@keyframes selectionBounce{0%,20%,40%,60%,80%,to{-webkit-animation-timing-function:cubic-bezier(.215,.61,.355,1);animation-timing-function:cubic-bezier(.215,.61,.355,1)}50%{-webkit-transform:scale3d(1.01,1.01,1.01);transform:scale3d(1.01,1.01,1.01)}70%{-webkit-transform:scale3d(1,1,1);transform:scaleZ(1)}}@-webkit-keyframes buttonClicked{0%,20%,40%,60%,80%,to{-webkit-animation-timing-function:cubic-bezier(.215,.61,.355,1);animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{-webkit-transform:scale3d(.95,.95,.95);transform:scale3d(.95,.95,.95)}60%{-webkit-transform:scale3d(1.02,1.02,1.02);transform:scale3d(1.02,1.02,1.02)}80%{-webkit-transform:scale3d(1,1,1);transform:scaleZ(1)}}@keyframes buttonClicked{0%,20%,40%,60%,80%,to{-webkit-animation-timing-function:cubic-bezier(.215,.61,.355,1);animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{-webkit-transform:scale3d(.95,.95,.95);transform:scale3d(.95,.95,.95)}60%{-webkit-transform:scale3d(1.02,1.02,1.02);transform:scale3d(1.02,1.02,1.02)}80%{-webkit-transform:scale3d(1,1,1);transform:scaleZ(1)}}.cdx-block{padding:.4em 0}.cdx-block::-webkit-input-placeholder{line-height:normal!important}.cdx-input{border:1px solid rgba(201,201,204,.48);-webkit-box-shadow:inset 0 1px 2px 0 rgba(35,44,72,.06);box-shadow:inset 0 1px 2px #232c480f;border-radius:3px;padding:10px 12px;outline:none;width:100%;-webkit-box-sizing:border-box;box-sizing:border-box}.cdx-input[data-placeholder]:before{position:static!important}.cdx-input[data-placeholder]:before{display:inline-block;width:0;white-space:nowrap;pointer-events:none}.cdx-settings-button{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;border-radius:3px;cursor:pointer;border:0;outline:none;background-color:transparent;vertical-align:bottom;color:inherit;margin:0;min-width:26px;min-height:26px}.cdx-settings-button--focused{background:rgba(34,186,255,.08)!important}.cdx-settings-button--focused{-webkit-box-shadow:inset 0 0 0px 1px rgba(7,161,227,.08);box-shadow:inset 0 0 0 1px #07a1e314}.cdx-settings-button--focused-animated{-webkit-animation-name:buttonClicked;animation-name:buttonClicked;-webkit-animation-duration:.25s;animation-duration:.25s}.cdx-settings-button--active{color:#388ae5}.cdx-settings-button svg{width:auto;height:auto}@media (max-width: 650px){.cdx-settings-button svg{width:28px;height:28px}}@media (max-width: 650px){.cdx-settings-button{width:36px;height:36px;border-radius:8px}}@media (hover: hover){.cdx-settings-button:hover{background-color:#eff2f5}}.cdx-loader{position:relative;border:1px solid rgba(201,201,204,.48)}.cdx-loader:before{content:"";position:absolute;left:50%;top:50%;width:18px;height:18px;margin:-11px 0 0 -11px;border:2px solid rgba(201,201,204,.48);border-left-color:#388ae5;border-radius:50%;-webkit-animation:cdxRotation 1.2s infinite linear;animation:cdxRotation 1.2s infinite linear}@-webkit-keyframes cdxRotation{0%{-webkit-transform:rotate(0deg);transform:rotate(0)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes cdxRotation{0%{-webkit-transform:rotate(0deg);transform:rotate(0)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}.cdx-button{padding:13px;border-radius:3px;border:1px solid rgba(201,201,204,.48);font-size:14.9px;background:#fff;-webkit-box-shadow:0 2px 2px 0 rgba(18,30,57,.04);box-shadow:0 2px 2px #121e390a;color:#707684;text-align:center;cursor:pointer}@media (hover: hover){.cdx-button:hover{background:#FBFCFE;-webkit-box-shadow:0 1px 3px 0 rgba(18,30,57,.08);box-shadow:0 1px 3px #121e3914}}.cdx-button svg{height:20px;margin-right:.2em;margin-top:-2px}.ce-stub{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:12px 18px;margin:10px 0;border-radius:10px;background:#eff2f5;border:1px solid #EFF0F1;color:#707684;font-size:14px}.ce-stub svg{width:20px;height:20px}.ce-stub__info{margin-left:14px}.ce-stub__title{font-weight:500;text-transform:capitalize}.codex-editor.codex-editor--rtl{direction:rtl}.codex-editor.codex-editor--rtl .cdx-list{padding-left:0;padding-right:40px}.codex-editor.codex-editor--rtl .ce-toolbar__plus{right:-26px;left:auto}.codex-editor.codex-editor--rtl .ce-toolbar__actions{right:auto;left:-26px}@media (max-width: 650px){.codex-editor.codex-editor--rtl .ce-toolbar__actions{margin-left:0;margin-right:auto;padding-right:0;padding-left:10px}}.codex-editor.codex-editor--rtl .ce-settings{left:5px;right:auto}.codex-editor.codex-editor--rtl .ce-settings:before{right:auto;left:25px}.codex-editor.codex-editor--rtl .ce-settings__button:not(:nth-child(3n+3)){margin-left:3px;margin-right:0}.codex-editor.codex-editor--rtl .ce-conversion-tool__icon{margin-right:0;margin-left:10px}.codex-editor.codex-editor--rtl .ce-inline-toolbar__dropdown{border-right:0px solid transparent;border-left:1px solid rgba(201,201,204,.48);margin:0 -6px 0 6px}.codex-editor.codex-editor--rtl .ce-inline-toolbar__dropdown .icon--toggler-down{margin-left:0;margin-right:4px}@media (min-width: 651px){.codex-editor--narrow.codex-editor--rtl .ce-toolbar__plus{left:0;right:5px}}@media (min-width: 651px){.codex-editor--narrow.codex-editor--rtl .ce-toolbar__actions{left:-5px}}.cdx-search-field{--icon-margin-right: 10px;background:#F8F8F8;border:1px solid rgba(226,226,229,.2);border-radius:6px;padding:2px;display:grid;grid-template-columns:auto auto 1fr;grid-template-rows:auto}.cdx-search-field__icon{width:26px;height:26px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;margin-right:var(--icon-margin-right)}.cdx-search-field__icon svg{width:20px;height:20px;color:#707684}.cdx-search-field__input{font-size:14px;outline:none;font-weight:500;font-family:inherit;border:0;background:transparent;margin:0;padding:0;line-height:22px;min-width:calc(100% - 26px - var(--icon-margin-right))}.cdx-search-field__input::-webkit-input-placeholder{color:#707684;font-weight:500}.cdx-search-field__input::-moz-placeholder{color:#707684;font-weight:500}.cdx-search-field__input:-ms-input-placeholder{color:#707684;font-weight:500}.cdx-search-field__input::-ms-input-placeholder{color:#707684;font-weight:500}.cdx-search-field__input::placeholder{color:#707684;font-weight:500}.ce-popover{--border-radius: 6px;--width: 200px;--max-height: 270px;--padding: 6px;--offset-from-target: 8px;--color-border: #EFF0F1;--color-shadow: rgba(13, 20, 33, .1);--color-background: white;--color-text-primary: black;--color-text-secondary: #707684;--color-border-icon: rgba(201, 201, 204, .48);--color-border-icon-disabled: #EFF0F1;--color-text-icon-active: #388AE5;--color-background-icon-active: rgba(56, 138, 229, .1);--color-background-item-focus: rgba(34, 186, 255, .08);--color-shadow-item-focus: rgba(7, 161, 227, .08);--color-background-item-hover: #F8F8F8;--color-background-item-confirm: #E24A4A;--color-background-item-confirm-hover: #CE4343;--popover-top: calc(100% + var(--offset-from-target));--popover-left: 0;--nested-popover-overlap: 4px;--icon-size: 20px;--item-padding: 3px;--item-height: calc(var(--icon-size) + 2 * var(--item-padding))}.ce-popover__container{min-width:var(--width);width:var(--width);max-height:var(--max-height);border-radius:var(--border-radius);overflow:hidden;-webkit-box-sizing:border-box;box-sizing:border-box;-webkit-box-shadow:0px 3px 15px -3px var(--color-shadow);box-shadow:0 3px 15px -3px var(--color-shadow);position:absolute;left:var(--popover-left);top:var(--popover-top);background:var(--color-background);display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;z-index:4;opacity:0;max-height:0;pointer-events:none;padding:0;border:none}.ce-popover--opened>.ce-popover__container{opacity:1;padding:var(--padding);max-height:var(--max-height);pointer-events:auto;-webkit-animation:panelShowing .1s ease;animation:panelShowing .1s ease;border:1px solid var(--color-border)}@media (max-width: 650px){.ce-popover--opened>.ce-popover__container{-webkit-animation:panelShowingMobile .25s ease;animation:panelShowingMobile .25s ease}}.ce-popover--open-top .ce-popover__container{--popover-top: calc(-1 * (var(--offset-from-target) + var(--popover-height)))}.ce-popover--open-left .ce-popover__container{--popover-left: calc(-1 * var(--width) + 100%)}.ce-popover__items{overflow-y:auto;-ms-scroll-chaining:none;overscroll-behavior:contain}@media (max-width: 650px){.ce-popover__overlay{position:fixed;top:0;bottom:0;left:0;right:0;background:#1D202B;z-index:3;opacity:.5;-webkit-transition:opacity .12s ease-in;transition:opacity .12s ease-in;will-change:opacity;visibility:visible}}.ce-popover__overlay--hidden{display:none}@media (max-width: 650px){.ce-popover .ce-popover__container{--offset: 5px;position:fixed;max-width:none;min-width:calc(100% - var(--offset) * 2);left:var(--offset);right:var(--offset);bottom:calc(var(--offset) + env(safe-area-inset-bottom));top:auto;border-radius:10px}}.ce-popover__search{margin-bottom:5px}.ce-popover__nothing-found-message{color:#707684;display:none;cursor:default;padding:3px;font-size:14px;line-height:20px;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ce-popover__nothing-found-message--displayed{display:block}.ce-popover--nested .ce-popover__container{--popover-left: calc(var(--nesting-level) * (var(--width) - var(--nested-popover-overlap)));top:calc(var(--trigger-item-top) - var(--nested-popover-overlap));position:absolute}.ce-popover--open-top.ce-popover--nested .ce-popover__container{top:calc(var(--trigger-item-top) - var(--popover-height) + var(--item-height) + var(--offset-from-target) + var(--nested-popover-overlap))}.ce-popover--open-left .ce-popover--nested .ce-popover__container{--popover-left: calc(-1 * (var(--nesting-level) + 1) * var(--width) + 100%)}.ce-popover-item-separator{padding:4px 3px}.ce-popover-item-separator--hidden{display:none}.ce-popover-item-separator__line{height:1px;background:var(--color-border);width:100%}.ce-popover-item-html--hidden{display:none}.ce-popover-item{--border-radius: 6px;border-radius:var(--border-radius);display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:var(--item-padding);color:var(--color-text-primary);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;border:none;background:transparent}@media (max-width: 650px){.ce-popover-item{padding:4px}}.ce-popover-item:not(:last-of-type){margin-bottom:1px}.ce-popover-item__icon{width:26px;height:26px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.ce-popover-item__icon svg{width:20px;height:20px}@media (max-width: 650px){.ce-popover-item__icon{width:36px;height:36px;border-radius:8px}.ce-popover-item__icon svg{width:28px;height:28px}}.ce-popover-item__icon--tool{margin-right:4px}.ce-popover-item__title{font-size:14px;line-height:20px;font-weight:500;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin-right:auto}@media (max-width: 650px){.ce-popover-item__title{font-size:16px}}.ce-popover-item__secondary-title{color:var(--color-text-secondary);font-size:12px;white-space:nowrap;letter-spacing:-.1em;padding-right:5px;opacity:.6}@media (max-width: 650px){.ce-popover-item__secondary-title{display:none}}.ce-popover-item--active{background:var(--color-background-icon-active);color:var(--color-text-icon-active)}.ce-popover-item--disabled{color:var(--color-text-secondary);cursor:default;pointer-events:none}.ce-popover-item--focused:not(.ce-popover-item--no-focus){background:var(--color-background-item-focus)!important}.ce-popover-item--hidden{display:none}@media (hover: hover){.ce-popover-item:hover{cursor:pointer}.ce-popover-item:hover:not(.ce-popover-item--no-hover){background-color:var(--color-background-item-hover)}}.ce-popover-item--confirmation{background:var(--color-background-item-confirm)}.ce-popover-item--confirmation .ce-popover-item__title,.ce-popover-item--confirmation .ce-popover-item__icon{color:#fff}@media (hover: hover){.ce-popover-item--confirmation:not(.ce-popover-item--no-hover):hover{background:var(--color-background-item-confirm-hover)}}.ce-popover-item--confirmation:not(.ce-popover-item--no-focus).ce-popover-item--focused{background:var(--color-background-item-confirm-hover)!important}@-webkit-keyframes panelShowing{0%{opacity:0;-webkit-transform:translateY(-8px) scale(.9);transform:translateY(-8px) scale(.9)}70%{opacity:1;-webkit-transform:translateY(2px);transform:translateY(2px)}to{-webkit-transform:translateY(0);transform:translateY(0)}}@keyframes panelShowing{0%{opacity:0;-webkit-transform:translateY(-8px) scale(.9);transform:translateY(-8px) scale(.9)}70%{opacity:1;-webkit-transform:translateY(2px);transform:translateY(2px)}to{-webkit-transform:translateY(0);transform:translateY(0)}}@-webkit-keyframes panelShowingMobile{0%{opacity:0;-webkit-transform:translateY(14px) scale(.98);transform:translateY(14px) scale(.98)}70%{opacity:1;-webkit-transform:translateY(-4px);transform:translateY(-4px)}to{-webkit-transform:translateY(0);transform:translateY(0)}}@keyframes panelShowingMobile{0%{opacity:0;-webkit-transform:translateY(14px) scale(.98);transform:translateY(14px) scale(.98)}70%{opacity:1;-webkit-transform:translateY(-4px);transform:translateY(-4px)}to{-webkit-transform:translateY(0);transform:translateY(0)}}.wobble{-webkit-animation-name:wobble;animation-name:wobble;-webkit-animation-duration:.4s;animation-duration:.4s}@-webkit-keyframes wobble{0%{-webkit-transform:translate3d(0,0,0);transform:translateZ(0)}15%{-webkit-transform:translate3d(-9%,0,0);transform:translate3d(-9%,0,0)}30%{-webkit-transform:translate3d(9%,0,0);transform:translate3d(9%,0,0)}45%{-webkit-transform:translate3d(-4%,0,0);transform:translate3d(-4%,0,0)}60%{-webkit-transform:translate3d(4%,0,0);transform:translate3d(4%,0,0)}75%{-webkit-transform:translate3d(-1%,0,0);transform:translate3d(-1%,0,0)}to{-webkit-transform:translate3d(0,0,0);transform:translateZ(0)}}@keyframes wobble{0%{-webkit-transform:translate3d(0,0,0);transform:translateZ(0)}15%{-webkit-transform:translate3d(-9%,0,0);transform:translate3d(-9%,0,0)}30%{-webkit-transform:translate3d(9%,0,0);transform:translate3d(9%,0,0)}45%{-webkit-transform:translate3d(-4%,0,0);transform:translate3d(-4%,0,0)}60%{-webkit-transform:translate3d(4%,0,0);transform:translate3d(4%,0,0)}75%{-webkit-transform:translate3d(-1%,0,0);transform:translate3d(-1%,0,0)}to{-webkit-transform:translate3d(0,0,0);transform:translateZ(0)}}.ce-popover-header{margin-bottom:8px;margin-top:4px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.ce-popover-header__text{font-size:18px;font-weight:600}.ce-popover-header__back-button{border:0;background:transparent;width:36px;height:36px;color:var(--color-text-primary)}.ce-popover-header__back-button svg{display:block;width:28px;height:28px}.ce-popover--inline{--height: 38px;--height-mobile: 46px;--container-padding: 4px;position:relative}.ce-popover--inline .ce-popover__custom-content{margin-bottom:0}.ce-popover--inline .ce-popover__items{display:-webkit-box;display:-ms-flexbox;display:flex}.ce-popover--inline .ce-popover__container{-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;padding:var(--container-padding);height:var(--height);top:0;min-width:-webkit-max-content;min-width:-moz-max-content;min-width:max-content;width:-webkit-max-content;width:-moz-max-content;width:max-content;-webkit-animation:none;animation:none}@media (max-width: 650px){.ce-popover--inline .ce-popover__container{height:var(--height-mobile);position:absolute}}.ce-popover--inline .ce-popover-item-separator{padding:0 4px}.ce-popover--inline .ce-popover-item-separator__line{height:100%;width:1px}.ce-popover--inline .ce-popover-item{border-radius:4px;padding:4px}.ce-popover--inline .ce-popover-item__icon--tool{-webkit-box-shadow:none;box-shadow:none;background:transparent;margin-right:0}.ce-popover--inline .ce-popover-item__icon{width:auto;width:initial;height:auto;height:initial}.ce-popover--inline .ce-popover-item__icon svg{width:20px;height:20px}@media (max-width: 650px){.ce-popover--inline .ce-popover-item__icon svg{width:28px;height:28px}}.ce-popover--inline .ce-popover-item:not(:last-of-type){margin-bottom:0;margin-bottom:initial}.ce-popover--inline .ce-popover-item-html{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.ce-popover--inline .ce-popover-item__icon--chevron-right{-webkit-transform:rotate(90deg);transform:rotate(90deg)}.ce-popover--inline .ce-popover--nested-level-1 .ce-popover__container{--offset: 3px;left:0;top:calc(var(--height) + var(--offset))}@media (max-width: 650px){.ce-popover--inline .ce-popover--nested-level-1 .ce-popover__container{top:calc(var(--height-mobile) + var(--offset))}}.ce-popover--inline .ce-popover--nested .ce-popover__container{min-width:var(--width);width:var(--width);height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;padding:6px;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}.ce-popover--inline .ce-popover--nested .ce-popover__items{display:block;width:100%}.ce-popover--inline .ce-popover--nested .ce-popover-item{border-radius:6px;padding:3px}@media (max-width: 650px){.ce-popover--inline .ce-popover--nested .ce-popover-item{padding:4px}}.ce-popover--inline .ce-popover--nested .ce-popover-item__icon--tool{margin-right:4px}.ce-popover--inline .ce-popover--nested .ce-popover-item__icon{width:26px;height:26px}.ce-popover--inline .ce-popover--nested .ce-popover-item-separator{padding:4px 3px}.ce-popover--inline .ce-popover--nested .ce-popover-item-separator__line{width:100%;height:1px}.codex-editor [data-placeholder]:empty:before,.codex-editor [data-placeholder][data-empty=true]:before{pointer-events:none;color:#707684;cursor:text;content:attr(data-placeholder)}.codex-editor [data-placeholder-active]:empty:before,.codex-editor [data-placeholder-active][data-empty=true]:before{pointer-events:none;color:#707684;cursor:text}.codex-editor [data-placeholder-active]:empty:focus:before,.codex-editor [data-placeholder-active][data-empty=true]:focus:before{content:attr(data-placeholder-active)}
|
|
103
|
-
`,Xm=class extends Ie{constructor(){super(...arguments),this.isMobile=!1,this.contentRectCache=null,this.resizeDebouncer=QT(()=>{this.windowResize()},200),this.selectionChangeDebounced=QT(()=>{this.selectionChanged()},f6),this.documentTouchedListener=e=>{this.documentTouched(e)}}get CSS(){return{editorWrapper:"codex-editor",editorWrapperNarrow:"codex-editor--narrow",editorZone:"codex-editor__redactor",editorZoneHidden:"codex-editor__redactor--hidden",editorEmpty:"codex-editor--empty",editorRtlFix:"codex-editor--rtl"}}get contentRect(){if(this.contentRectCache!==null)return this.contentRectCache;let e=this.nodes.wrapper.querySelector(`.${go.CSS.content}`);return e?(this.contentRectCache=e.getBoundingClientRect(),this.contentRectCache):{width:650,left:0,right:0}}async prepare(){this.setIsMobile(),this.make(),this.loadStyles()}toggleReadOnly(e){e?this.unbindReadOnlySensitiveListeners():window.requestIdleCallback(()=>{this.bindReadOnlySensitiveListeners()},{timeout:2e3})}checkEmptiness(){let{BlockManager:e}=this.Editor;this.nodes.wrapper.classList.toggle(this.CSS.editorEmpty,e.isEditorEmpty)}get someToolbarOpened(){let{Toolbar:e,BlockSettings:n,InlineToolbar:o}=this.Editor;return!!(n.opened||o.opened||e.toolbox.opened)}get someFlipperButtonFocused(){return this.Editor.Toolbar.toolbox.hasFocus()?!0:Object.entries(this.Editor).filter(([e,n])=>n.flipper instanceof ga).some(([e,n])=>n.flipper.hasFocus())}destroy(){this.nodes.holder.innerHTML="",this.unbindReadOnlyInsensitiveListeners()}closeAllToolbars(){let{Toolbar:e,BlockSettings:n,InlineToolbar:o}=this.Editor;n.close(),o.close(),e.toolbox.close()}setIsMobile(){let e=window.innerWidth<fS;e!==this.isMobile&&this.eventsDispatcher.emit(tc,{isEnabled:this.isMobile}),this.isMobile=e}make(){this.nodes.holder=z.getHolder(this.config.holder),this.nodes.wrapper=z.make("div",[this.CSS.editorWrapper,...this.isRtl?[this.CSS.editorRtlFix]:[]]),this.nodes.redactor=z.make("div",this.CSS.editorZone),this.nodes.holder.offsetWidth<this.contentRect.width&&this.nodes.wrapper.classList.add(this.CSS.editorWrapperNarrow),this.nodes.redactor.style.paddingBottom=this.config.minHeight+"px",this.nodes.wrapper.appendChild(this.nodes.redactor),this.nodes.holder.appendChild(this.nodes.wrapper),this.bindReadOnlyInsensitiveListeners()}loadStyles(){let e="editor-js-styles";if(z.get(e))return;let n=z.make("style",null,{id:e,textContent:E6.toString()});this.config.style&&!lo(this.config.style)&&this.config.style.nonce&&n.setAttribute("nonce",this.config.style.nonce),z.prepend(document.head,n)}bindReadOnlyInsensitiveListeners(){this.listeners.on(document,"selectionchange",this.selectionChangeDebounced),this.listeners.on(window,"resize",this.resizeDebouncer,{passive:!0}),this.listeners.on(this.nodes.redactor,"mousedown",this.documentTouchedListener,{capture:!0,passive:!0}),this.listeners.on(this.nodes.redactor,"touchstart",this.documentTouchedListener,{capture:!0,passive:!0})}unbindReadOnlyInsensitiveListeners(){this.listeners.off(document,"selectionchange",this.selectionChangeDebounced),this.listeners.off(window,"resize",this.resizeDebouncer),this.listeners.off(this.nodes.redactor,"mousedown",this.documentTouchedListener),this.listeners.off(this.nodes.redactor,"touchstart",this.documentTouchedListener)}bindReadOnlySensitiveListeners(){this.readOnlyMutableListeners.on(this.nodes.redactor,"click",e=>{this.redactorClicked(e)},!1),this.readOnlyMutableListeners.on(document,"keydown",e=>{this.documentKeydown(e)},!0),this.readOnlyMutableListeners.on(document,"mousedown",e=>{this.documentClicked(e)},!0),this.watchBlockHoveredEvents(),this.enableInputsEmptyMark()}watchBlockHoveredEvents(){let e;this.readOnlyMutableListeners.on(this.nodes.redactor,"mousemove",em(n=>{let o=n.target.closest(".ce-block");this.Editor.BlockSelection.anyBlockSelected||o&&e!==o&&(e=o,this.eventsDispatcher.emit(LS,{block:this.Editor.BlockManager.getBlockByChildNode(o)}))},20),{passive:!0})}unbindReadOnlySensitiveListeners(){this.readOnlyMutableListeners.clearAll()}windowResize(){this.contentRectCache=null,this.setIsMobile()}documentKeydown(e){switch(e.keyCode){case Ce.ENTER:this.enterPressed(e);break;case Ce.BACKSPACE:case Ce.DELETE:this.backspacePressed(e);break;case Ce.ESC:this.escapePressed(e);break;default:this.defaultBehaviour(e);break}}defaultBehaviour(e){let{currentBlock:n}=this.Editor.BlockManager,o=e.target.closest(`.${this.CSS.editorWrapper}`),r=e.altKey||e.ctrlKey||e.metaKey||e.shiftKey;if(n!==void 0&&o===null){this.Editor.BlockEvents.keydown(e);return}o||n&&r||(this.Editor.BlockManager.unsetCurrentBlock(),this.Editor.Toolbar.close())}backspacePressed(e){let{BlockManager:n,BlockSelection:o,Caret:r}=this.Editor;if(o.anyBlockSelected&&!ge.isSelectionExists){let i=n.removeSelectedBlocks(),s=n.insertDefaultBlockAtIndex(i,!0);r.setToBlock(s,r.positions.START),o.clearSelection(e),e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation()}}escapePressed(e){this.Editor.BlockSelection.clearSelection(e),this.Editor.Toolbar.toolbox.opened?(this.Editor.Toolbar.toolbox.close(),this.Editor.Caret.setToBlock(this.Editor.BlockManager.currentBlock,this.Editor.Caret.positions.END)):this.Editor.BlockSettings.opened?this.Editor.BlockSettings.close():this.Editor.InlineToolbar.opened?this.Editor.InlineToolbar.close():this.Editor.Toolbar.close()}enterPressed(e){let{BlockManager:n,BlockSelection:o}=this.Editor;if(this.someToolbarOpened)return;let r=n.currentBlockIndex>=0;if(o.anyBlockSelected&&!ge.isSelectionExists){o.clearSelection(e),e.preventDefault(),e.stopImmediatePropagation(),e.stopPropagation();return}if(!this.someToolbarOpened&&r&&e.target.tagName==="BODY"){let i=this.Editor.BlockManager.insert();e.preventDefault(),this.Editor.Caret.setToBlock(i),this.Editor.Toolbar.moveAndOpen(i)}this.Editor.BlockSelection.clearSelection(e)}documentClicked(e){var n,o;if(!e.isTrusted)return;let r=e.target;this.nodes.holder.contains(r)||ge.isAtEditor||(this.Editor.BlockManager.unsetCurrentBlock(),this.Editor.Toolbar.close());let i=(n=this.Editor.BlockSettings.nodes.wrapper)==null?void 0:n.contains(r),s=(o=this.Editor.Toolbar.nodes.settingsToggler)==null?void 0:o.contains(r),a=i||s;if(this.Editor.BlockSettings.opened&&!a){this.Editor.BlockSettings.close();let l=this.Editor.BlockManager.getBlockByChildNode(r);this.Editor.Toolbar.moveAndOpen(l)}this.Editor.BlockSelection.clearSelection(e)}documentTouched(e){let n=e.target;if(n===this.nodes.redactor){let o=e instanceof MouseEvent?e.clientX:e.touches[0].clientX,r=e instanceof MouseEvent?e.clientY:e.touches[0].clientY;n=document.elementFromPoint(o,r)}try{this.Editor.BlockManager.setCurrentBlockByChildNode(n)}catch{this.Editor.RectangleSelection.isRectActivated()||this.Editor.Caret.setToTheLastBlock()}this.Editor.ReadOnly.isEnabled||this.Editor.Toolbar.moveAndOpen()}redactorClicked(e){if(!ge.isCollapsed)return;let n=e.target,o=e.metaKey||e.ctrlKey;if(z.isAnchor(n)&&o){e.stopImmediatePropagation(),e.stopPropagation();let r=n.getAttribute("href"),i=FH(r);$H(i);return}this.processBottomZoneClick(e)}processBottomZoneClick(e){let n=this.Editor.BlockManager.getBlockByIndex(-1),o=z.offset(n.holder).bottom,r=e.pageY,{BlockSelection:i}=this.Editor;if(e.target instanceof Element&&e.target.isEqualNode(this.nodes.redactor)&&!i.anyBlockSelected&&o<r){e.stopImmediatePropagation(),e.stopPropagation();let{BlockManager:s,Caret:a,Toolbar:l}=this.Editor;(!s.lastBlock.tool.isDefault||!s.lastBlock.isEmpty)&&s.insertAtEnd(),a.setToTheLastBlock(),l.moveAndOpen(s.lastBlock)}}selectionChanged(){let{CrossBlockSelection:e,BlockSelection:n}=this.Editor,o=ge.anchorElement;if(e.isCrossBlockSelectionStarted&&n.anyBlockSelected&&ge.get().removeAllRanges(),!o){ge.range||this.Editor.InlineToolbar.close();return}let r=o.closest(`.${go.CSS.content}`);(r===null||r.closest(`.${ge.CSS.editorWrapper}`)!==this.nodes.wrapper)&&(this.Editor.InlineToolbar.containsNode(o)||this.Editor.InlineToolbar.close(),o.dataset.inlineToolbar!=="true")||(this.Editor.BlockManager.currentBlock||this.Editor.BlockManager.setCurrentBlockByChildNode(o),this.Editor.InlineToolbar.tryToShow(!0))}enableInputsEmptyMark(){function e(n){let o=n.target;hS(o)}this.readOnlyMutableListeners.on(this.nodes.wrapper,"input",e),this.readOnlyMutableListeners.on(this.nodes.wrapper,"focusin",e),this.readOnlyMutableListeners.on(this.nodes.wrapper,"focusout",e)}},w6={BlocksAPI:sm,CaretAPI:am,EventsAPI:lm,I18nAPI:cm,API:dm,InlineToolbarAPI:um,ListenersAPI:pm,NotifierAPI:hm,ReadOnlyAPI:gm,SanitizerAPI:mm,SaverAPI:_m,SelectionAPI:bm,ToolsAPI:ym,StylesAPI:xm,ToolbarAPI:vm,TooltipAPI:Cm,UiAPI:Em,BlockSettings:Dm,Toolbar:Im,InlineToolbar:Am,BlockEvents:Rm,BlockManager:Fm,BlockSelection:Bm,Caret:$m,CrossBlockSelection:zm,DragNDrop:Hm,ModificationsObserver:Km,Paste:g6,ReadOnly:Um,RectangleSelection:jm,Renderer:Vm,Saver:Wm,Tools:Bu,UI:Xm},Zm=class{constructor(e){this.moduleInstances={},this.eventsDispatcher=new Qi;let n,o;this.isReady=new Promise((r,i)=>{n=r,o=i}),Promise.resolve().then(async()=>{this.configuration=e,this.validate(),this.init(),await this.start(),await this.render();let{BlockManager:r,Caret:i,UI:s,ModificationsObserver:a}=this.moduleInstances;s.checkEmptiness(),a.enable(),this.configuration.autofocus===!0&&this.configuration.readOnly!==!0&&i.setToBlock(r.blocks[0],i.positions.START),n()}).catch(r=>{Ue(`Editor.js is not ready because of ${r}`,"error"),o(r)})}set configuration(e){var n,o;nn(e)?this.config={...e}:this.config={holder:e},nm(!!this.config.holderId,"config.holderId","config.holder"),this.config.holderId&&!this.config.holder&&(this.config.holder=this.config.holderId,this.config.holderId=null),this.config.holder==null&&(this.config.holder="editorjs"),this.config.logLevel||(this.config.logLevel=dS.VERBOSE),IH(this.config.logLevel),nm(!!this.config.initialBlock,"config.initialBlock","config.defaultBlock"),this.config.defaultBlock=this.config.defaultBlock||this.config.initialBlock||"paragraph",this.config.minHeight=this.config.minHeight!==void 0?this.config.minHeight:300;let r={type:this.config.defaultBlock,data:{}};this.config.placeholder=this.config.placeholder||!1,this.config.sanitizer=this.config.sanitizer||{p:!0,b:!0,a:!0},this.config.hideToolbar=this.config.hideToolbar?this.config.hideToolbar:!1,this.config.tools=this.config.tools||{},this.config.i18n=this.config.i18n||{},this.config.data=this.config.data||{blocks:[]},this.config.onReady=this.config.onReady||(()=>{}),this.config.onChange=this.config.onChange||(()=>{}),this.config.inlineToolbar=this.config.inlineToolbar!==void 0?this.config.inlineToolbar:!0,(lo(this.config.data)||!this.config.data.blocks||this.config.data.blocks.length===0)&&(this.config.data={blocks:[r]}),this.config.readOnly=this.config.readOnly||!1,(n=this.config.i18n)!=null&&n.messages&&mn.setDictionary(this.config.i18n.messages),this.config.i18n.direction=((o=this.config.i18n)==null?void 0:o.direction)||"ltr"}get configuration(){return this.config}validate(){let{holderId:e,holder:n}=this.config;if(e&&n)throw Error("\xABholderId\xBB and \xABholder\xBB param can't assign at the same time.");if(yr(n)&&!z.get(n))throw Error(`element with ID \xAB${n}\xBB is missing. Pass correct holder's ID.`);if(n&&nn(n)&&!z.isElement(n))throw Error("\xABholder\xBB value must be an Element node")}init(){this.constructModules(),this.configureModules()}async start(){await["Tools","UI","BlockManager","Paste","BlockSelection","RectangleSelection","CrossBlockSelection","ReadOnly"].reduce((e,n)=>e.then(async()=>{try{await this.moduleInstances[n].prepare()}catch(o){if(o instanceof wu)throw new Error(o.message);Ue(`Module ${n} was skipped because of %o`,"warn",o)}}),Promise.resolve())}render(){return this.moduleInstances.Renderer.render(this.config.data.blocks)}constructModules(){Object.entries(w6).forEach(([e,n])=>{try{this.moduleInstances[e]=new n({config:this.configuration,eventsDispatcher:this.eventsDispatcher})}catch(o){Ue("[constructModules]",`Module ${e} skipped because`,"error",o)}})}configureModules(){for(let e in this.moduleInstances)Object.prototype.hasOwnProperty.call(this.moduleInstances,e)&&(this.moduleInstances[e].state=this.getModulesDiff(e))}getModulesDiff(e){let n={};for(let o in this.moduleInstances)o!==e&&(n[o]=this.moduleInstances[o]);return n}};var $u=class{static get version(){return"2.31.0-rc.7"}constructor(e){let n=()=>{};nn(e)&<(e.onReady)&&(n=e.onReady);let o=new Zm(e);this.isReady=o.isReady.then(()=>{this.exportAPI(o),n()})}exportAPI(e){let n=["configuration"],o=()=>{Object.values(e.moduleInstances).forEach(r=>{lt(r.destroy)&&r.destroy(),r.listeners.removeAll()}),l4(),e=null;for(let r in this)Object.prototype.hasOwnProperty.call(this,r)&&delete this[r];Object.setPrototypeOf(this,null)};n.forEach(r=>{this[r]=e[r]}),this.destroy=o,Object.setPrototypeOf(this,e.moduleInstances.API.methods),delete this.exportAPI,Object.entries({blocks:{clear:"clear",render:"render"},caret:{focus:"focus"},events:{on:"on",off:"off",emit:"emit"},saver:{save:"save"}}).forEach(([r,i])=>{Object.entries(i).forEach(([s,a])=>{this[a]=e.moduleInstances.API.methods[r][s]})})}};(function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode(".ce-header{padding:.6em 0 3px;margin:0;line-height:1.25em;outline:none}.ce-header p,.ce-header div{padding:0!important;margin:0!important}")),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();var T6='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M6 7L6 12M6 17L6 12M6 12L12 12M12 7V12M12 17L12 12"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M19 17V10.2135C19 10.1287 18.9011 10.0824 18.836 10.1367L16 12.5"/></svg>',S6='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M6 7L6 12M6 17L6 12M6 12L12 12M12 7V12M12 17L12 12"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M16 11C16 10 19 9.5 19 12C19 13.9771 16.0684 13.9997 16.0012 16.8981C15.9999 16.9533 16.0448 17 16.1 17L19.3 17"/></svg>',k6='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M6 7L6 12M6 17L6 12M6 12L12 12M12 7V12M12 17L12 12"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M16 11C16 10.5 16.8323 10 17.6 10C18.3677 10 19.5 10.311 19.5 11.5C19.5 12.5315 18.7474 12.9022 18.548 12.9823C18.5378 12.9864 18.5395 13.0047 18.5503 13.0063C18.8115 13.0456 20 13.3065 20 14.8C20 16 19.5 17 17.8 17C17.8 17 16 17 16 16.3"/></svg>',N6='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M6 7L6 12M6 17L6 12M6 12L12 12M12 7V12M12 17L12 12"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M18 10L15.2834 14.8511C15.246 14.9178 15.294 15 15.3704 15C16.8489 15 18.7561 15 20.2 15M19 17C19 15.7187 19 14.8813 19 13.6"/></svg>',D6='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M6 7L6 12M6 17L6 12M6 12L12 12M12 7V12M12 17L12 12"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M16 15.9C16 15.9 16.3768 17 17.8 17C19.5 17 20 15.6199 20 14.7C20 12.7323 17.6745 12.0486 16.1635 12.9894C16.094 13.0327 16 12.9846 16 12.9027V10.1C16 10.0448 16.0448 10 16.1 10H19.8"/></svg>',O6='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M6 7L6 12M6 17L6 12M6 12L12 12M12 7V12M12 17L12 12"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M19.5 10C16.5 10.5 16 13.3285 16 15M16 15V15C16 16.1046 16.8954 17 18 17H18.3246C19.3251 17 20.3191 16.3492 20.2522 15.3509C20.0612 12.4958 16 12.6611 16 15Z"/></svg>',I6='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M9 7L9 12M9 17V12M9 12L15 12M15 7V12M15 17L15 12"/></svg>';var qu=class{constructor({data:e,config:n,api:o,readOnly:r}){this.api=o,this.readOnly=r,this._settings=n,this._data=this.normalizeData(e),this._element=this.getTag()}get _CSS(){return{block:this.api.styles.block,wrapper:"ce-header"}}isHeaderData(e){return e.text!==void 0}normalizeData(e){let n={text:"",level:this.defaultLevel.number};return this.isHeaderData(e)&&(n.text=e.text||"",e.level!==void 0&&!isNaN(parseInt(e.level.toString()))&&(n.level=parseInt(e.level.toString()))),n}render(){return this._element}renderSettings(){return this.levels.map(e=>({icon:e.svg,label:this.api.i18n.t(`Heading ${e.number}`),onActivate:()=>this.setLevel(e.number),closeOnActivate:!0,isActive:this.currentLevel.number===e.number,render:()=>document.createElement("div")}))}setLevel(e){this.data={level:e,text:this.data.text}}merge(e){this._element.insertAdjacentHTML("beforeend",e.text)}validate(e){return e.text.trim()!==""}save(e){return{text:e.innerHTML,level:this.currentLevel.number}}static get conversionConfig(){return{export:"text",import:"text"}}static get sanitize(){return{level:!1,text:{}}}static get isReadOnlySupported(){return!0}get data(){return this._data.text=this._element.innerHTML,this._data.level=this.currentLevel.number,this._data}set data(e){if(this._data=this.normalizeData(e),e.level!==void 0&&this._element.parentNode){let n=this.getTag();n.innerHTML=this._element.innerHTML,this._element.parentNode.replaceChild(n,this._element),this._element=n}e.text!==void 0&&(this._element.innerHTML=this._data.text||"")}getTag(){let e=document.createElement(this.currentLevel.tag);return e.innerHTML=this._data.text||"",e.classList.add(this._CSS.wrapper),e.contentEditable=this.readOnly?"false":"true",e.dataset.placeholder=this.api.i18n.t(this._settings.placeholder||""),e}get currentLevel(){let e=this.levels.find(n=>n.number===this._data.level);return e||(e=this.defaultLevel),e}get defaultLevel(){if(this._settings.defaultLevel){let e=this.levels.find(n=>n.number===this._settings.defaultLevel);if(e)return e;console.warn("(\u0E07'\u0300-'\u0301)\u0E07 Heading Tool: the default level specified was not found in available levels")}return this.levels[1]}get levels(){let e=[{number:1,tag:"H1",svg:T6},{number:2,tag:"H2",svg:S6},{number:3,tag:"H3",svg:k6},{number:4,tag:"H4",svg:N6},{number:5,tag:"H5",svg:D6},{number:6,tag:"H6",svg:O6}];return this._settings.levels?e.filter(n=>this._settings.levels.includes(n.number)):e}onPaste(e){let n=e.detail;if("data"in n){let o=n.data,r=this.defaultLevel.number;switch(o.tagName){case"H1":r=1;break;case"H2":r=2;break;case"H3":r=3;break;case"H4":r=4;break;case"H5":r=5;break;case"H6":r=6;break}this._settings.levels&&(r=this._settings.levels.reduce((i,s)=>Math.abs(s-r)<Math.abs(i-r)?s:i)),this.data={level:r,text:o.innerHTML}}}static get pasteConfig(){return{tags:["H1","H2","H3","H4","H5","H6"]}}static get toolbox(){return{icon:I6,title:"Heading"}}};(function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode('.image-tool{--bg-color: #cdd1e0;--front-color: #388ae5;--border-color: #e8e8eb}.image-tool__image{border-radius:3px;overflow:hidden;margin-bottom:10px;padding-bottom:0}.image-tool__image-picture{max-width:100%;vertical-align:bottom;display:block}.image-tool__image-preloader{width:50px;height:50px;border-radius:50%;background-size:cover;margin:auto;position:relative;background-color:var(--bg-color);background-position:center center}.image-tool__image-preloader:after{content:"";position:absolute;z-index:3;width:60px;height:60px;border-radius:50%;border:2px solid var(--bg-color);border-top-color:var(--front-color);left:50%;top:50%;margin-top:-30px;margin-left:-30px;animation:image-preloader-spin 2s infinite linear;box-sizing:border-box}.image-tool__caption{visibility:hidden;position:absolute;bottom:0;left:0;margin-bottom:10px}.image-tool__caption[contentEditable=true][data-placeholder]:before{position:absolute!important;content:attr(data-placeholder);color:#707684;font-weight:400;display:none}.image-tool__caption[contentEditable=true][data-placeholder]:empty:before{display:block}.image-tool__caption[contentEditable=true][data-placeholder]:empty:focus:before{display:none}.image-tool--empty .image-tool__image,.image-tool--empty .image-tool__image-preloader{display:none}.image-tool--empty .image-tool__caption,.image-tool--uploading .image-tool__caption{visibility:hidden!important}.image-tool .cdx-button{display:flex;align-items:center;justify-content:center}.image-tool .cdx-button svg{height:auto;margin:0 6px 0 0}.image-tool--filled .cdx-button,.image-tool--filled .image-tool__image-preloader{display:none}.image-tool--uploading .image-tool__image{min-height:200px;display:flex;border:1px solid var(--border-color);background-color:#fff}.image-tool--uploading .image-tool__image-picture,.image-tool--uploading .cdx-button{display:none}.image-tool--withBorder .image-tool__image{border:1px solid var(--border-color)}.image-tool--withBackground .image-tool__image{padding:15px;background:var(--bg-color)}.image-tool--withBackground .image-tool__image-picture{max-width:60%;margin:0 auto}.image-tool--stretched .image-tool__image-picture{width:100%}.image-tool--caption .image-tool__caption{visibility:visible}.image-tool--caption{padding-bottom:50px}@keyframes image-preloader-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}')),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();var M6='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 19V19C9.13623 19 8.20435 19 7.46927 18.6955C6.48915 18.2895 5.71046 17.5108 5.30448 16.5307C5 15.7956 5 14.8638 5 13V12C5 9.19108 5 7.78661 5.67412 6.77772C5.96596 6.34096 6.34096 5.96596 6.77772 5.67412C7.78661 5 9.19108 5 12 5H13.5C14.8956 5 15.5933 5 16.1611 5.17224C17.4395 5.56004 18.44 6.56046 18.8278 7.83886C19 8.40666 19 9.10444 19 10.5V10.5"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M16 13V16M16 19V16M19 16H16M16 16H13"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6.5 17.5L17.5 6.5"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M18.9919 10.5H19.0015"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10.9919 19H11.0015"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13L13 5"/></svg>',A6='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M18.9919 9.5H19.0015"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14.5 5H14.5096"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M14.625 5H15C17.2091 5 19 6.79086 19 9V9.375"/><path stroke="currentColor" stroke-width="2" d="M9.375 5L9 5C6.79086 5 5 6.79086 5 9V9.375"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.3725 5H9.38207"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 9.5H5.00957"/><path stroke="currentColor" stroke-width="2" d="M9.375 19H9C6.79086 19 5 17.2091 5 15V14.625"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.3725 19H9.38207"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 14.55H5.00957"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M16 13V16M16 19V16M19 16H16M16 16H13"/></svg>',uk='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><rect width="14" height="14" x="5" y="5" stroke="currentColor" stroke-width="2" rx="4"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5.13968 15.32L8.69058 11.5661C9.02934 11.2036 9.48873 11 9.96774 11C10.4467 11 10.9061 11.2036 11.2449 11.5661L15.3871 16M13.5806 14.0664L15.0132 12.533C15.3519 12.1705 15.8113 11.9668 16.2903 11.9668C16.7693 11.9668 17.2287 12.1705 17.5675 12.533L18.841 13.9634"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13.7778 9.33331H13.7867"/></svg>',L6='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 9L20 12L17 15"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14 12H20"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 9L4 12L7 15"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 12H10"/></svg>',R6='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M8 9V7.2C8 7.08954 8.08954 7 8.2 7L12 7M16 9V7.2C16 7.08954 15.9105 7 15.8 7L12 7M12 7L12 17M12 17H10M12 17H14"/></svg>';function ya(t,e=null,n={}){let o=document.createElement(t);Array.isArray(e)?o.classList.add(...e):e!==null&&o.classList.add(e);for(let r in n)n.hasOwnProperty(r)&&(o[r]=n[r]);return o}var Ju=(t=>(t.Empty="empty",t.Uploading="uploading",t.Filled="filled",t))(Ju||{}),W_=class{constructor({api:e,config:n,onSelectFile:o,readOnly:r}){this.api=e,this.config=n,this.onSelectFile=o,this.readOnly=r,this.nodes={wrapper:ya("div",[this.CSS.baseClass,this.CSS.wrapper]),imageContainer:ya("div",[this.CSS.imageContainer]),fileButton:this.createFileButton(),imageEl:void 0,imagePreloader:ya("div",this.CSS.imagePreloader),caption:ya("div",[this.CSS.input,this.CSS.caption],{contentEditable:!this.readOnly})},this.nodes.caption.dataset.placeholder=this.config.captionPlaceholder,this.nodes.imageContainer.appendChild(this.nodes.imagePreloader),this.nodes.wrapper.appendChild(this.nodes.imageContainer),this.nodes.wrapper.appendChild(this.nodes.caption),this.nodes.wrapper.appendChild(this.nodes.fileButton)}applyTune(e,n){this.nodes.wrapper.classList.toggle(`${this.CSS.wrapper}--${e}`,n)}render(){return this.toggleStatus("empty"),this.nodes.wrapper}showPreloader(e){this.nodes.imagePreloader.style.backgroundImage=`url(${e})`,this.toggleStatus("uploading")}hidePreloader(){this.nodes.imagePreloader.style.backgroundImage="",this.toggleStatus("empty")}fillImage(e){let n=/\.mp4$/.test(e)?"VIDEO":"IMG",o={src:e},r="load";n==="VIDEO"&&(o.autoplay=!0,o.loop=!0,o.muted=!0,o.playsinline=!0,r="loadeddata"),this.nodes.imageEl=ya(n,this.CSS.imageEl,o),this.nodes.imageEl.addEventListener(r,()=>{this.toggleStatus("filled"),this.nodes.imagePreloader!==void 0&&(this.nodes.imagePreloader.style.backgroundImage="")}),this.nodes.imageContainer.appendChild(this.nodes.imageEl)}fillCaption(e){this.nodes.caption!==void 0&&(this.nodes.caption.innerHTML=e)}toggleStatus(e){for(let n in Ju)if(Object.prototype.hasOwnProperty.call(Ju,n)){let o=Ju[n];this.nodes.wrapper.classList.toggle(`${this.CSS.wrapper}--${o}`,o===e)}}get CSS(){return{baseClass:this.api.styles.block,loading:this.api.styles.loader,input:this.api.styles.input,button:this.api.styles.button,wrapper:"image-tool",imageContainer:"image-tool__image",imagePreloader:"image-tool__image-preloader",imageEl:"image-tool__image-picture",caption:"image-tool__caption"}}createFileButton(){let e=ya("div",[this.CSS.button]);return e.innerHTML=this.config.buttonContent??`${uk} ${this.api.i18n.t("Select an Image")}`,e.addEventListener("click",()=>{this.onSelectFile()}),e}};function P6(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var pk={exports:{}};(function(t,e){(function(n,o){t.exports=o()})(window,function(){return(function(n){var o={};function r(i){if(o[i])return o[i].exports;var s=o[i]={i,l:!1,exports:{}};return n[i].call(s.exports,s,s.exports,r),s.l=!0,s.exports}return r.m=n,r.c=o,r.d=function(i,s,a){r.o(i,s)||Object.defineProperty(i,s,{enumerable:!0,get:a})},r.r=function(i){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(i,"__esModule",{value:!0})},r.t=function(i,s){if(1&s&&(i=r(i)),8&s||4&s&&typeof i=="object"&&i&&i.__esModule)return i;var a=Object.create(null);if(r.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:i}),2&s&&typeof i!="string")for(var l in i)r.d(a,l,(function(c){return i[c]}).bind(null,l));return a},r.n=function(i){var s=i&&i.__esModule?function(){return i.default}:function(){return i};return r.d(s,"a",s),s},r.o=function(i,s){return Object.prototype.hasOwnProperty.call(i,s)},r.p="",r(r.s=3)})([function(n,o){var r;r=(function(){return this})();try{r=r||new Function("return this")()}catch{typeof window=="object"&&(r=window)}n.exports=r},function(n,o,r){(function(i){var s=r(2),a=setTimeout;function l(){}function c(_){if(!(this instanceof c))throw new TypeError("Promises must be constructed via new");if(typeof _!="function")throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],m(_,this)}function d(_,b){for(;_._state===3;)_=_._value;_._state!==0?(_._handled=!0,c._immediateFn(function(){var y=_._state===1?b.onFulfilled:b.onRejected;if(y!==null){var x;try{x=y(_._value)}catch(v){return void p(b.promise,v)}u(b.promise,x)}else(_._state===1?u:p)(b.promise,_._value)})):_._deferreds.push(b)}function u(_,b){try{if(b===_)throw new TypeError("A promise cannot be resolved with itself.");if(b&&(typeof b=="object"||typeof b=="function")){var y=b.then;if(b instanceof c)return _._state=3,_._value=b,void f(_);if(typeof y=="function")return void m((x=y,v=b,function(){x.apply(v,arguments)}),_)}_._state=1,_._value=b,f(_)}catch(E){p(_,E)}var x,v}function p(_,b){_._state=2,_._value=b,f(_)}function f(_){_._state===2&&_._deferreds.length===0&&c._immediateFn(function(){_._handled||c._unhandledRejectionFn(_._value)});for(var b=0,y=_._deferreds.length;b<y;b++)d(_,_._deferreds[b]);_._deferreds=null}function h(_,b,y){this.onFulfilled=typeof _=="function"?_:null,this.onRejected=typeof b=="function"?b:null,this.promise=y}function m(_,b){var y=!1;try{_(function(x){y||(y=!0,u(b,x))},function(x){y||(y=!0,p(b,x))})}catch(x){if(y)return;y=!0,p(b,x)}}c.prototype.catch=function(_){return this.then(null,_)},c.prototype.then=function(_,b){var y=new this.constructor(l);return d(this,new h(_,b,y)),y},c.prototype.finally=s.a,c.all=function(_){return new c(function(b,y){if(!_||_.length===void 0)throw new TypeError("Promise.all accepts an array");var x=Array.prototype.slice.call(_);if(x.length===0)return b([]);var v=x.length;function E(k,T){try{if(T&&(typeof T=="object"||typeof T=="function")){var w=T.then;if(typeof w=="function")return void w.call(T,function(S){E(k,S)},y)}x[k]=T,--v==0&&b(x)}catch(S){y(S)}}for(var C=0;C<x.length;C++)E(C,x[C])})},c.resolve=function(_){return _&&typeof _=="object"&&_.constructor===c?_:new c(function(b){b(_)})},c.reject=function(_){return new c(function(b,y){y(_)})},c.race=function(_){return new c(function(b,y){for(var x=0,v=_.length;x<v;x++)_[x].then(b,y)})},c._immediateFn=typeof i=="function"&&function(_){i(_)}||function(_){a(_,0)},c._unhandledRejectionFn=function(_){typeof console<"u"&&console&&console.warn("Possible Unhandled Promise Rejection:",_)},o.a=c}).call(this,r(5).setImmediate)},function(n,o,r){o.a=function(i){var s=this.constructor;return this.then(function(a){return s.resolve(i()).then(function(){return a})},function(a){return s.resolve(i()).then(function(){return s.reject(a)})})}},function(n,o,r){function i(m){return(i=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(_){return typeof _}:function(_){return _&&typeof Symbol=="function"&&_.constructor===Symbol&&_!==Symbol.prototype?"symbol":typeof _})(m)}r(4);var s,a,l,c,d,u,p,f=r(8),h=(a=function(m){return new Promise(function(_,b){m=c(m),(m=d(m)).beforeSend&&m.beforeSend();var y=window.XMLHttpRequest?new window.XMLHttpRequest:new window.ActiveXObject("Microsoft.XMLHTTP");y.open(m.method,m.url),y.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(m.headers).forEach(function(v){var E=m.headers[v];y.setRequestHeader(v,E)});var x=m.ratio;y.upload.addEventListener("progress",function(v){var E=Math.round(v.loaded/v.total*100),C=Math.ceil(E*x/100);m.progress(Math.min(C,100))},!1),y.addEventListener("progress",function(v){var E=Math.round(v.loaded/v.total*100),C=Math.ceil(E*(100-x)/100)+x;m.progress(Math.min(C,100))},!1),y.onreadystatechange=function(){if(y.readyState===4){var v=y.response;try{v=JSON.parse(v)}catch{}var E=f.parseHeaders(y.getAllResponseHeaders()),C={body:v,code:y.status,headers:E};p(y.status)?_(C):b(C)}},y.send(m.data)})},l=function(m){return m.method="POST",a(m)},c=function(){var m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(m.url&&typeof m.url!="string")throw new Error("Url must be a string");if(m.url=m.url||"",m.method&&typeof m.method!="string")throw new Error("`method` must be a string or null");if(m.method=m.method?m.method.toUpperCase():"GET",m.headers&&i(m.headers)!=="object")throw new Error("`headers` must be an object or null");if(m.headers=m.headers||{},m.type&&(typeof m.type!="string"||!Object.values(s).includes(m.type)))throw new Error("`type` must be taken from module's \xABcontentType\xBB library");if(m.progress&&typeof m.progress!="function")throw new Error("`progress` must be a function or null");if(m.progress=m.progress||function(_){},m.beforeSend=m.beforeSend||function(_){},m.ratio&&typeof m.ratio!="number")throw new Error("`ratio` must be a number");if(m.ratio<0||m.ratio>100)throw new Error("`ratio` must be in a 0-100 interval");if(m.ratio=m.ratio||90,m.accept&&typeof m.accept!="string")throw new Error("`accept` must be a string with a list of allowed mime-types");if(m.accept=m.accept||"*/*",m.multiple&&typeof m.multiple!="boolean")throw new Error("`multiple` must be a true or false");if(m.multiple=m.multiple||!1,m.fieldName&&typeof m.fieldName!="string")throw new Error("`fieldName` must be a string");return m.fieldName=m.fieldName||"files",m},d=function(m){switch(m.method){case"GET":var _=u(m.data,s.URLENCODED);delete m.data,m.url=/\?/.test(m.url)?m.url+"&"+_:m.url+"?"+_;break;case"POST":case"PUT":case"DELETE":case"UPDATE":var b=(function(){return(arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}).type||s.JSON})(m);(f.isFormData(m.data)||f.isFormElement(m.data))&&(b=s.FORM),m.data=u(m.data,b),b!==h.contentType.FORM&&(m.headers["content-type"]=b)}return m},u=function(){var m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};switch(arguments.length>1?arguments[1]:void 0){case s.URLENCODED:return f.urlEncode(m);case s.JSON:return f.jsonEncode(m);case s.FORM:return f.formEncode(m);default:return m}},p=function(m){return m>=200&&m<300},{contentType:s={URLENCODED:"application/x-www-form-urlencoded; charset=utf-8",FORM:"multipart/form-data",JSON:"application/json; charset=utf-8"},request:a,get:function(m){return m.method="GET",a(m)},post:l,transport:function(m){return m=c(m),f.selectFiles(m).then(function(_){for(var b=new FormData,y=0;y<_.length;y++)b.append(m.fieldName,_[y],_[y].name);f.isObject(m.data)&&Object.keys(m.data).forEach(function(v){var E=m.data[v];b.append(v,E)});var x=m.beforeSend;return m.beforeSend=function(){return x(_)},m.data=b,l(m)})},selectFiles:function(m){return delete(m=c(m)).beforeSend,f.selectFiles(m)}});n.exports=h},function(n,o,r){r.r(o);var i=r(1);window.Promise=window.Promise||i.a},function(n,o,r){(function(i){var s=i!==void 0&&i||typeof self<"u"&&self||window,a=Function.prototype.apply;function l(c,d){this._id=c,this._clearFn=d}o.setTimeout=function(){return new l(a.call(setTimeout,s,arguments),clearTimeout)},o.setInterval=function(){return new l(a.call(setInterval,s,arguments),clearInterval)},o.clearTimeout=o.clearInterval=function(c){c&&c.close()},l.prototype.unref=l.prototype.ref=function(){},l.prototype.close=function(){this._clearFn.call(s,this._id)},o.enroll=function(c,d){clearTimeout(c._idleTimeoutId),c._idleTimeout=d},o.unenroll=function(c){clearTimeout(c._idleTimeoutId),c._idleTimeout=-1},o._unrefActive=o.active=function(c){clearTimeout(c._idleTimeoutId);var d=c._idleTimeout;d>=0&&(c._idleTimeoutId=setTimeout(function(){c._onTimeout&&c._onTimeout()},d))},r(6),o.setImmediate=typeof self<"u"&&self.setImmediate||i!==void 0&&i.setImmediate||this&&this.setImmediate,o.clearImmediate=typeof self<"u"&&self.clearImmediate||i!==void 0&&i.clearImmediate||this&&this.clearImmediate}).call(this,r(0))},function(n,o,r){(function(i,s){(function(a,l){if(!a.setImmediate){var c,d,u,p,f,h=1,m={},_=!1,b=a.document,y=Object.getPrototypeOf&&Object.getPrototypeOf(a);y=y&&y.setTimeout?y:a,{}.toString.call(a.process)==="[object process]"?c=function(E){s.nextTick(function(){v(E)})}:(function(){if(a.postMessage&&!a.importScripts){var E=!0,C=a.onmessage;return a.onmessage=function(){E=!1},a.postMessage("","*"),a.onmessage=C,E}})()?(p="setImmediate$"+Math.random()+"$",f=function(E){E.source===a&&typeof E.data=="string"&&E.data.indexOf(p)===0&&v(+E.data.slice(p.length))},a.addEventListener?a.addEventListener("message",f,!1):a.attachEvent("onmessage",f),c=function(E){a.postMessage(p+E,"*")}):a.MessageChannel?((u=new MessageChannel).port1.onmessage=function(E){v(E.data)},c=function(E){u.port2.postMessage(E)}):b&&"onreadystatechange"in b.createElement("script")?(d=b.documentElement,c=function(E){var C=b.createElement("script");C.onreadystatechange=function(){v(E),C.onreadystatechange=null,d.removeChild(C),C=null},d.appendChild(C)}):c=function(E){setTimeout(v,0,E)},y.setImmediate=function(E){typeof E!="function"&&(E=new Function(""+E));for(var C=new Array(arguments.length-1),k=0;k<C.length;k++)C[k]=arguments[k+1];var T={callback:E,args:C};return m[h]=T,c(h),h++},y.clearImmediate=x}function x(E){delete m[E]}function v(E){if(_)setTimeout(v,0,E);else{var C=m[E];if(C){_=!0;try{(function(k){var T=k.callback,w=k.args;switch(w.length){case 0:T();break;case 1:T(w[0]);break;case 2:T(w[0],w[1]);break;case 3:T(w[0],w[1],w[2]);break;default:T.apply(l,w)}})(C)}finally{x(E),_=!1}}}}})(typeof self>"u"?i===void 0?this:i:self)}).call(this,r(0),r(7))},function(n,o){var r,i,s=n.exports={};function a(){throw new Error("setTimeout has not been defined")}function l(){throw new Error("clearTimeout has not been defined")}function c(y){if(r===setTimeout)return setTimeout(y,0);if((r===a||!r)&&setTimeout)return r=setTimeout,setTimeout(y,0);try{return r(y,0)}catch{try{return r.call(null,y,0)}catch{return r.call(this,y,0)}}}(function(){try{r=typeof setTimeout=="function"?setTimeout:a}catch{r=a}try{i=typeof clearTimeout=="function"?clearTimeout:l}catch{i=l}})();var d,u=[],p=!1,f=-1;function h(){p&&d&&(p=!1,d.length?u=d.concat(u):f=-1,u.length&&m())}function m(){if(!p){var y=c(h);p=!0;for(var x=u.length;x;){for(d=u,u=[];++f<x;)d&&d[f].run();f=-1,x=u.length}d=null,p=!1,(function(v){if(i===clearTimeout)return clearTimeout(v);if((i===l||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(v);try{i(v)}catch{try{return i.call(null,v)}catch{return i.call(this,v)}}})(y)}}function _(y,x){this.fun=y,this.array=x}function b(){}s.nextTick=function(y){var x=new Array(arguments.length-1);if(arguments.length>1)for(var v=1;v<arguments.length;v++)x[v-1]=arguments[v];u.push(new _(y,x)),u.length!==1||p||c(m)},_.prototype.run=function(){this.fun.apply(null,this.array)},s.title="browser",s.browser=!0,s.env={},s.argv=[],s.version="",s.versions={},s.on=b,s.addListener=b,s.once=b,s.off=b,s.removeListener=b,s.removeAllListeners=b,s.emit=b,s.prependListener=b,s.prependOnceListener=b,s.listeners=function(y){return[]},s.binding=function(y){throw new Error("process.binding is not supported")},s.cwd=function(){return"/"},s.chdir=function(y){throw new Error("process.chdir is not supported")},s.umask=function(){return 0}},function(n,o,r){function i(a,l){for(var c=0;c<l.length;c++){var d=l[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}var s=r(9);n.exports=(function(){function a(){(function(u,p){if(!(u instanceof p))throw new TypeError("Cannot call a class as a function")})(this,a)}var l,c,d;return l=a,d=[{key:"urlEncode",value:function(u){return s(u)}},{key:"jsonEncode",value:function(u){return JSON.stringify(u)}},{key:"formEncode",value:function(u){if(this.isFormData(u))return u;if(this.isFormElement(u))return new FormData(u);if(this.isObject(u)){var p=new FormData;return Object.keys(u).forEach(function(f){var h=u[f];p.append(f,h)}),p}throw new Error("`data` must be an instance of Object, FormData or <FORM> HTMLElement")}},{key:"isObject",value:function(u){return Object.prototype.toString.call(u)==="[object Object]"}},{key:"isFormData",value:function(u){return u instanceof FormData}},{key:"isFormElement",value:function(u){return u instanceof HTMLFormElement}},{key:"selectFiles",value:function(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return new Promise(function(p,f){var h=document.createElement("INPUT");h.type="file",u.multiple&&h.setAttribute("multiple","multiple"),u.accept&&h.setAttribute("accept",u.accept),h.style.display="none",document.body.appendChild(h),h.addEventListener("change",function(m){var _=m.target.files;p(_),document.body.removeChild(h)},!1),h.click()})}},{key:"parseHeaders",value:function(u){var p=u.trim().split(/[\r\n]+/),f={};return p.forEach(function(h){var m=h.split(": "),_=m.shift(),b=m.join(": ");_&&(f[_]=b)}),f}}],(c=null)&&i(l.prototype,c),d&&i(l,d),a})()},function(n,o){var r=function(s){return encodeURIComponent(s).replace(/[!'()*]/g,escape).replace(/%20/g,"+")},i=function(s,a,l,c){return a=a||null,l=l||"&",c=c||null,s?(function(d){for(var u=new Array,p=0;p<d.length;p++)d[p]&&u.push(d[p]);return u})(Object.keys(s).map(function(d){var u,p,f=d;if(c&&(f=c+"["+f+"]"),typeof s[d]=="object"&&s[d]!==null)u=i(s[d],null,l,f);else{a&&(p=f,f=!isNaN(parseFloat(p))&&isFinite(p)?a+Number(f):f);var h=s[d];h=(h=(h=(h=h===!0?"1":h)===!1?"0":h)===0?"0":h)||"",u=r(f)+"="+r(h)}return u})).join(l).replace(/[!'()*]/g,""):""};n.exports=i}])})})(pk);var F6=pk.exports,xa=P6(F6);function V_(t){return t!==void 0&&typeof t.then=="function"}var G_=class{constructor({config:e,onUpload:n,onError:o}){this.config=e,this.onUpload=n,this.onError=o}uploadSelectedFile({onPreview:e}){let n=function(r){let i=new FileReader;i.readAsDataURL(r),i.onload=s=>{e(s.target.result)}},o;if(this.config.uploader&&typeof this.config.uploader.uploadByFile=="function"){let r=this.config.uploader.uploadByFile;o=xa.selectFiles({accept:this.config.types??"image/*"}).then(i=>{n(i[0]);let s=r(i[0]);return V_(s)||console.warn("Custom uploader method uploadByFile should return a Promise"),s})}else o=xa.transport({url:this.config.endpoints.byFile,data:this.config.additionalRequestData,accept:this.config.types??"image/*",headers:this.config.additionalRequestHeaders,beforeSend:r=>{n(r[0])},fieldName:this.config.field??"image"}).then(r=>r.body);o.then(r=>{this.onUpload(r)}).catch(r=>{this.onError(r)})}uploadByUrl(e){let n;this.config.uploader&&typeof this.config.uploader.uploadByUrl=="function"?(n=this.config.uploader.uploadByUrl(e),V_(n)||console.warn("Custom uploader method uploadByUrl should return a Promise")):n=xa.post({url:this.config.endpoints.byUrl,data:Object.assign({url:e},this.config.additionalRequestData),type:xa.contentType.JSON,headers:this.config.additionalRequestHeaders}).then(o=>o.body),n.then(o=>{this.onUpload(o)}).catch(o=>{this.onError(o)})}uploadByFile(e,{onPreview:n}){let o=new FileReader;o.readAsDataURL(e),o.onload=i=>{n(i.target.result)};let r;if(this.config.uploader&&typeof this.config.uploader.uploadByFile=="function")r=this.config.uploader.uploadByFile(e),V_(r)||console.warn("Custom uploader method uploadByFile should return a Promise");else{let i=new FormData;i.append(this.config.field??"image",e),this.config.additionalRequestData&&Object.keys(this.config.additionalRequestData).length&&Object.entries(this.config.additionalRequestData).forEach(([s,a])=>{i.append(s,a)}),r=xa.post({url:this.config.endpoints.byFile,data:i,type:xa.contentType.JSON,headers:this.config.additionalRequestHeaders}).then(s=>s.body)}r.then(i=>{this.onUpload(i)}).catch(i=>{this.onError(i)})}};var Xu=class t{constructor({data:e,config:n,api:o,readOnly:r,block:i}){this.isCaptionEnabled=null,this.api=o,this.block=i,this.config={endpoints:n.endpoints,additionalRequestData:n.additionalRequestData,additionalRequestHeaders:n.additionalRequestHeaders,field:n.field,types:n.types,captionPlaceholder:this.api.i18n.t(n.captionPlaceholder??"Caption"),buttonContent:n.buttonContent,uploader:n.uploader,actions:n.actions,features:n.features||{}},this.uploader=new G_({config:this.config,onUpload:s=>this.onUpload(s),onError:s=>this.uploadingFailed(s)}),this.ui=new W_({api:o,config:this.config,onSelectFile:()=>{this.uploader.uploadSelectedFile({onPreview:s=>{this.ui.showPreloader(s)}})},readOnly:r}),this._data={caption:"",withBorder:!1,withBackground:!1,stretched:!1,file:{url:""}},this.data=e}static get isReadOnlySupported(){return!0}static get toolbox(){return{icon:uk,title:"Image"}}static get tunes(){return[{name:"withBorder",icon:A6,title:"With border",toggle:!0},{name:"stretched",icon:L6,title:"Stretch image",toggle:!0},{name:"withBackground",icon:M6,title:"With background",toggle:!0}]}render(){var e,n,o;return(((e=this.config.features)==null?void 0:e.caption)===!0||((n=this.config.features)==null?void 0:n.caption)===void 0||((o=this.config.features)==null?void 0:o.caption)==="optional"&&this.data.caption)&&(this.isCaptionEnabled=!0),this.ui.render()}validate(e){return!!e.file.url}save(){let e=this.ui.nodes.caption;return this._data.caption=e.innerHTML,this.data}renderSettings(){var e;let n=t.tunes.concat(this.config.actions||[]),o={border:"withBorder",background:"withBackground",stretch:"stretched",caption:"caption"};((e=this.config.features)==null?void 0:e.caption)==="optional"&&n.push({name:"caption",icon:R6,title:"With caption",toggle:!0});let r=n.filter(s=>{var a,l;let c=Object.keys(o).find(d=>o[d]===s.name);return c==="caption"?((a=this.config.features)==null?void 0:a.caption)!==!1:c==null||((l=this.config.features)==null?void 0:l[c])!==!1}),i=s=>{let a=this.data[s.name];return s.name==="caption"&&(a=this.isCaptionEnabled??a),a};return r.map(s=>({icon:s.icon,label:this.api.i18n.t(s.title),name:s.name,toggle:s.toggle,isActive:i(s),onActivate:()=>{if(typeof s.action=="function"){s.action(s.name);return}let a=!i(s);s.name==="caption"&&(this.isCaptionEnabled=!(this.isCaptionEnabled??!1),a=this.isCaptionEnabled),this.tuneToggled(s.name,a)}}))}appendCallback(){this.ui.nodes.fileButton.click()}static get pasteConfig(){return{tags:[{img:{src:!0}}],patterns:{image:/https?:\/\/\S+\.(gif|jpe?g|tiff|png|svg|webp)(\?[a-z0-9=]*)?$/i},files:{mimeTypes:["image/*"]}}}async onPaste(e){switch(e.type){case"tag":{let n=e.detail.data;if(/^blob:/.test(n.src)){let o=await(await fetch(n.src)).blob();this.uploadFile(o);break}this.uploadUrl(n.src);break}case"pattern":{let n=e.detail.data;this.uploadUrl(n);break}case"file":{let n=e.detail.file;this.uploadFile(n);break}}}set data(e){this.image=e.file,this._data.caption=e.caption||"",this.ui.fillCaption(this._data.caption),t.tunes.forEach(({name:n})=>{let o=typeof e[n]<"u"?e[n]===!0||e[n]==="true":!1;this.setTune(n,o)}),e.caption&&this.setTune("caption",!0)}get data(){return this._data}set image(e){this._data.file=e||{url:""},e&&e.url&&this.ui.fillImage(e.url)}onUpload(e){e.success&&e.file?this.image=e.file:this.uploadingFailed("incorrect response: "+JSON.stringify(e))}uploadingFailed(e){console.log("Image Tool: uploading failed because of",e),this.api.notifier.show({message:this.api.i18n.t("Couldn\u2019t upload image. Please try another."),style:"error"}),this.ui.hidePreloader()}tuneToggled(e,n){e==="caption"?(this.ui.applyTune(e,n),n==!1&&(this._data.caption="",this.ui.fillCaption(""))):this.setTune(e,n)}setTune(e,n){this._data[e]=n,this.ui.applyTune(e,n),e==="stretched"&&Promise.resolve().then(()=>{this.block.stretched=n}).catch(o=>{console.error(o)})}uploadFile(e){this.uploader.uploadByFile(e,{onPreview:n=>{this.ui.showPreloader(n)}})}uploadUrl(e){this.ui.showPreloader(e),this.uploader.uploadByUrl(e)}};(function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode('.cdx-nested-list{margin:0;padding:0;outline:none;counter-reset:item;list-style:none}.cdx-nested-list__item{line-height:1.6em;display:flex;margin:2px 0}.cdx-nested-list__item [contenteditable]{outline:none}.cdx-nested-list__item-body{flex-grow:2}.cdx-nested-list__item-content,.cdx-nested-list__item-children{flex-basis:100%}.cdx-nested-list__item-content{word-break:break-word;white-space:pre-wrap}.cdx-nested-list__item:before{counter-increment:item;margin-right:5px;white-space:nowrap}.cdx-nested-list--ordered>.cdx-nested-list__item:before{content:counters(item,".") ". "}.cdx-nested-list--unordered>.cdx-nested-list__item:before{content:"\u2022"}.cdx-nested-list__settings{display:flex}.cdx-nested-list__settings .cdx-settings-button{width:50%}')),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();function xr(t){return t.nodeType===Node.ELEMENT_NODE}function va(t,e=null,n){let o=document.createElement(t);Array.isArray(e)?o.classList.add(...e):e&&o.classList.add(e);for(let r in n)o[r]=n[r];return o}function fk(t){let e=va("div");return e.appendChild(t),e.innerHTML}function gk(t){let e;return t.nodeType!==Node.ELEMENT_NODE?e=t.textContent:(e=t.innerHTML,e=e.replaceAll("<br>","")),e?.trim().length===0}var oi=class t{constructor(){this.savedFakeCaret=void 0}save(){let e=t.range,n=va("span");n.hidden=!0,e&&(e.insertNode(n),this.savedFakeCaret=n)}restore(){if(!this.savedFakeCaret)return;let e=window.getSelection();if(!e)return;let n=new Range;n.setStartAfter(this.savedFakeCaret),n.setEndAfter(this.savedFakeCaret),e.removeAllRanges(),e.addRange(n),setTimeout(()=>{var o;(o=this.savedFakeCaret)==null||o.remove()},150)}static get range(){let e=window.getSelection();return e&&e.rangeCount?e.getRangeAt(0):null}static extractFragmentFromCaretPositionTillTheEnd(){let e=window.getSelection();if(!e||!e.rangeCount)return;let n=e.getRangeAt(0),o=n.startContainer;if(o.nodeType!==Node.ELEMENT_NODE){if(!o.parentNode)return;o=o.parentNode}if(!xr(o))return;let r=o.closest("[contenteditable]");if(!r)return;n.deleteContents();let i=n.cloneRange();return i.selectNodeContents(r),i.setStart(n.endContainer,n.endOffset),i.extractContents()}static focus(e,n=!0){let o=document.createRange(),r=window.getSelection();r&&(o.selectNodeContents(e),o.collapse(n),r.removeAllRanges(),r.addRange(o))}static isAtStart(){let e=window.getSelection();if(!e||e.focusOffset>0)return!1;let n=e.focusNode;return!n||!xr(n)?!1:t.getHigherLevelSiblings(n,"left").every(o=>gk(o))}static getHigherLevelSiblings(e,n="left"){let o=e,r=[];for(;o.parentNode&&o.parentNode.contentEditable!=="true";)o=o.parentNode;let i=n==="left"?"previousSibling":"nextSibling";for(;o[i];)o=o[i],r.push(o);return r}},B6='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><line x1="9" x2="19" y1="7" y2="7" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><line x1="9" x2="19" y1="12" y2="12" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><line x1="9" x2="19" y1="17" y2="17" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M5.00001 17H4.99002"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M5.00001 12H4.99002"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M5.00001 7H4.99002"/></svg>',hk='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><line x1="12" x2="19" y1="7" y2="7" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><line x1="12" x2="19" y1="12" y2="12" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><line x1="12" x2="19" y1="17" y2="17" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M7.79999 14L7.79999 7.2135C7.79999 7.12872 7.7011 7.0824 7.63597 7.13668L4.79999 9.5"/></svg>',cc=class t{static get isReadOnlySupported(){return!0}static get enableLineBreaks(){return!0}static get toolbox(){return{icon:hk,title:"List"}}constructor({data:e,config:n,api:o,readOnly:r}){var i;this.nodes={wrapper:null},this.api=o,this.readOnly=r,this.config=n,this.defaultListStyle=((i=this.config)==null?void 0:i.defaultStyle)==="ordered"?"ordered":"unordered";let s={style:this.defaultListStyle,items:[]};this.data=e&&Object.keys(e).length?e:s,this.caret=new oi}render(){return this.nodes.wrapper=this.makeListWrapper(this.data.style,[this.CSS.baseBlock]),this.data.items.length?this.appendItems(this.data.items,this.nodes.wrapper):this.appendItems([{content:"",items:[]}],this.nodes.wrapper),this.readOnly||this.nodes.wrapper.addEventListener("keydown",e=>{switch(e.key){case"Enter":this.enterPressed(e);break;case"Backspace":this.backspace(e);break;case"Tab":e.shiftKey?this.shiftTab(e):this.addTab(e);break}},!1),this.nodes.wrapper}renderSettings(){return[{name:"unordered",label:this.api.i18n.t("Unordered"),icon:B6},{name:"ordered",label:this.api.i18n.t("Ordered"),icon:hk}].map(e=>({name:e.name,icon:e.icon,label:e.label,isActive:this.data.style===e.name,closeOnActivate:!0,onActivate:()=>{this.listStyle=e.name}}))}static get pasteConfig(){return{tags:["OL","UL","LI"]}}onPaste(e){let n=e.detail.data;this.data=this.pasteHandler(n);let o=this.nodes.wrapper;o&&o.parentNode&&o.parentNode.replaceChild(this.render(),o)}pasteHandler(e){let{tagName:n}=e,o="unordered",r;switch(n){case"OL":o="ordered",r="ol";break;case"UL":case"LI":o="unordered",r="ul"}let i={style:o,items:[]},s=a=>Array.from(a.querySelectorAll(":scope > li")).map(l=>{var c;let d=l.querySelector(`:scope > ${r}`),u=d?s(d):[];return{content:((c=l?.firstChild)==null?void 0:c.textContent)||"",items:u}});return i.items=s(e),i}appendItems(e,n){e.forEach(o=>{let r=this.createItem(o.content,o.items);n.appendChild(r)})}createItem(e,n=[]){let o=va("li",this.CSS.item),r=va("div",this.CSS.itemBody),i=va("div",this.CSS.itemContent,{innerHTML:e,contentEditable:(!this.readOnly).toString()});return r.appendChild(i),o.appendChild(r),n&&n.length>0&&this.addChildrenList(o,n),o}save(){let e=n=>Array.from(n.querySelectorAll(`:scope > .${this.CSS.item}`)).map(o=>{let r=o.querySelector(`.${this.CSS.itemChildren}`),i=this.getItemContent(o),s=r?e(r):[];return{content:i,items:s}});return{style:this.data.style,items:this.nodes.wrapper?e(this.nodes.wrapper):[]}}addChildrenList(e,n){let o=e.querySelector(`.${this.CSS.itemBody}`),r=this.makeListWrapper(void 0,[this.CSS.itemChildren]);this.appendItems(n,r),o&&o.appendChild(r)}makeListWrapper(e=this.listStyle,n=[]){let o=e==="ordered"?"ol":"ul",r=e==="ordered"?this.CSS.wrapperOrdered:this.CSS.wrapperUnordered;return n.push(r),va(o,[this.CSS.wrapper,...n])}get CSS(){return{baseBlock:this.api.styles.block,wrapper:"cdx-nested-list",wrapperOrdered:"cdx-nested-list--ordered",wrapperUnordered:"cdx-nested-list--unordered",item:"cdx-nested-list__item",itemBody:"cdx-nested-list__item-body",itemContent:"cdx-nested-list__item-content",itemChildren:"cdx-nested-list__item-children",settingsWrapper:"cdx-nested-list__settings",settingsButton:this.api.styles.settingsButton,settingsButtonActive:this.api.styles.settingsButtonActive}}get listStyle(){return this.data.style||this.defaultListStyle}set listStyle(e){if(!this.nodes||!this.nodes.wrapper)return;let n=Array.from(this.nodes.wrapper.querySelectorAll(`.${this.CSS.wrapper}`));n.push(this.nodes.wrapper),n.forEach(o=>{o.classList.toggle(this.CSS.wrapperUnordered,e==="unordered"),o.classList.toggle(this.CSS.wrapperOrdered,e==="ordered")}),this.data.style=e}get currentItem(){let e=window.getSelection();if(!e)return null;let n=e.anchorNode;return!n||(xr(n)||(n=n.parentNode),!n)||!xr(n)?null:n.closest(`.${this.CSS.item}`)}enterPressed(e){let n=this.currentItem;if(e.stopPropagation(),e.preventDefault(),e.isComposing)return;let o=n?this.getItemContent(n).trim().length===0:!0,r=n?.parentNode===this.nodes.wrapper,i=n?.nextElementSibling===null;if(r&&i&&o){this.getOutOfList();return}else if(i&&o){this.unshiftItem();return}let s=oi.extractFragmentFromCaretPositionTillTheEnd();if(!s)return;let a=fk(s),l=n?.querySelector(`.${this.CSS.itemChildren}`),c=this.createItem(a,void 0);l&&Array.from(l.querySelectorAll(`.${this.CSS.item}`)).length>0?l.prepend(c):n?.after(c),this.focusItem(c)}unshiftItem(){let e=this.currentItem;if(!e||!e.parentNode||!xr(e.parentNode))return;let n=e.parentNode.closest(`.${this.CSS.item}`);if(!n)return;this.caret.save(),n.after(e),this.caret.restore();let o=n.querySelector(`.${this.CSS.itemChildren}`);o&&o.children.length===0&&o.remove()}getItemContent(e){let n=e.querySelector(`.${this.CSS.itemContent}`);return!n||gk(n)?"":n.innerHTML}focusItem(e,n=!0){let o=e.querySelector(`.${this.CSS.itemContent}`);o&&oi.focus(o,n)}getOutOfList(){var e;(e=this.currentItem)==null||e.remove(),this.api.blocks.insert(),this.api.caret.setToBlock(this.api.blocks.getCurrentBlockIndex())}backspace(e){if(!oi.isAtStart())return;e.preventDefault();let n=this.currentItem;if(!n)return;let o=n.previousSibling;if(!n.parentNode||!xr(n.parentNode))return;let r=n.parentNode.closest(`.${this.CSS.item}`);if(!o&&!r||o&&!xr(o))return;e.stopPropagation();let i;if(o){let d=o.querySelectorAll(`.${this.CSS.item}`);i=Array.from(d).pop()||o}else i=r;let s=oi.extractFragmentFromCaretPositionTillTheEnd();if(!s)return;let a=fk(s);if(!i)return;let l=i.querySelector(`.${this.CSS.itemContent}`);if(!l)return;oi.focus(l,!1),this.caret.save(),l.insertAdjacentHTML("beforeend",a);let c=n.querySelectorAll(`.${this.CSS.itemChildren} > .${this.CSS.item}`);c=Array.from(c),c=c.filter(d=>!d.parentNode||!xr(d.parentNode)?!1:d.parentNode.closest(`.${this.CSS.item}`)===n),c.reverse().forEach(d=>{o?i.after(d):n.after(d)}),n.remove(),this.caret.restore()}addTab(e){e.stopPropagation(),e.preventDefault();let n=this.currentItem;if(!n)return;let o=n.previousSibling;if(!o||!xr(o)||!o)return;let r=o.querySelector(`.${this.CSS.itemChildren}`);if(this.caret.save(),r)r.appendChild(n);else{let i=this.makeListWrapper(void 0,[this.CSS.itemChildren]),s=o.querySelector(`.${this.CSS.itemBody}`);i.appendChild(n),s?.appendChild(i)}this.caret.restore()}shiftTab(e){e.stopPropagation(),e.preventDefault(),this.unshiftItem()}static joinRecursive(e){return e.items.map(n=>`${n.content} ${t.joinRecursive(n)}`).join("")}static get conversionConfig(){return{export:e=>t.joinRecursive(e),import:e=>({items:[{content:e,items:[]}],style:"unordered"})}}};(function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode(".ce-rawtool__textarea{min-height:200px;resize:vertical;border-radius:8px;border:0;background-color:#1e2128;font-family:Menlo,Monaco,Consolas,Courier New,monospace;font-size:12px;line-height:1.6;letter-spacing:-.2px;color:#a1a7b6;overscroll-behavior:contain}")),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();var $6='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16.6954 5C17.912 5 18.8468 6.07716 18.6755 7.28165L17.426 16.0659C17.3183 16.8229 16.7885 17.4522 16.061 17.6873L12.6151 18.8012C12.2152 18.9304 11.7848 18.9304 11.3849 18.8012L7.93898 17.6873C7.21148 17.4522 6.6817 16.8229 6.57403 16.0659L5.32454 7.28165C5.15322 6.07716 6.088 5 7.30461 5H16.6954Z"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 8.4H9L9.42857 11.7939H14.5714L14.3571 13.2788L14.1429 14.7636L12 15.4L9.85714 14.7636L9.77143 14.3394"/></svg>';var Zu=class t{static get isReadOnlySupported(){return!0}static get displayInToolbox(){return!0}static get enableLineBreaks(){return!0}static get toolbox(){return{icon:$6,title:"Raw HTML"}}constructor({data:e,config:n,api:o,readOnly:r}){this.api=o,this.readOnly=r,this.placeholder=o.i18n.t(n.placeholder||t.DEFAULT_PLACEHOLDER),this.CSS={baseClass:this.api.styles.block,input:this.api.styles.input,wrapper:"ce-rawtool",textarea:"ce-rawtool__textarea"},this.data={html:e.html||""},this.textarea=null,this.resizeDebounce=null}render(){let e=document.createElement("div"),n=100;return this.textarea=document.createElement("textarea"),e.classList.add(this.CSS.baseClass,this.CSS.wrapper),this.textarea.classList.add(this.CSS.textarea,this.CSS.input),this.textarea.textContent=this.data.html,this.textarea.placeholder=this.placeholder,this.readOnly?this.textarea.disabled=!0:this.textarea.addEventListener("input",()=>{this.onInput()}),e.appendChild(this.textarea),setTimeout(()=>{this.resize()},n),e}save(e){return{html:e.querySelector("textarea").value}}static get DEFAULT_PLACEHOLDER(){return"Enter HTML code"}static get sanitize(){return{html:!0}}onInput(){this.resizeDebounce&&clearTimeout(this.resizeDebounce),this.resizeDebounce=setTimeout(()=>{this.resize()},200)}resize(){this.textarea.style.height="auto",this.textarea.style.height=this.textarea.scrollHeight+"px"}};ke();var Y_=class t{static get CSS(){return""}static get shortcut(){return"CMD+SHIFT+X"}constructor(e){this.api=e.api,this.button=document.createElement("button"),this.iconClasses={base:this.api.styles.inlineToolButton,active:this.api.styles.inlineToolButtonActive}}static get isInline(){return!0}render(){return this.button?(this.button.type="button",this.button.classList.add(this.iconClasses.base),this.button.innerHTML=this.toolboxIcon,this.button):null}surround(e){if(!e)return;let n=this.api.selection.findParentTag("S",t.CSS);n?this.unwrap(n):this.wrap(e)}wrap(e){let n=document.createElement("S");n.appendChild(e.extractContents()),e.insertNode(n),this.api.selection.expandToTag(n)}unwrap(e){this.api.selection.expandToTag(e);let n=window.getSelection(),o=n.getRangeAt(0),r=o.extractContents();e.parentNode.removeChild(e),o.insertNode(r),n.removeAllRanges(),n.addRange(o)}checkState(){let e=this.api.selection.findParentTag("S",t.CSS);this.button.classList.toggle(this.iconClasses.active,!!e)}get toolboxIcon(){return'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="12" height="12"><path d="M17.154 14c.23.516.346 1.09.346 1.72 0 1.342-.524 2.392-1.571 3.147C14.88 19.622 13.433 20 11.586 20c-1.64 0-3.263-.381-4.87-1.144V16.6c1.52.877 3.075 1.316 4.666 1.316 2.551 0 3.83-.732 3.839-2.197a2.21 2.21 0 0 0-.648-1.603l-.12-.117H3v-2h18v2h-3.846zm-4.078-3H7.629a4.086 4.086 0 0 1-.481-.522C6.716 9.92 6.5 9.246 6.5 8.452c0-1.236.466-2.287 1.397-3.153C8.83 4.433 10.271 4 12.222 4c1.471 0 2.879.328 4.222.984v2.152c-1.2-.687-2.515-1.03-3.946-1.03-2.48 0-3.719.782-3.719 2.346 0 .42.218.786.654 1.099.436.313.974.562 1.613.75.62.18 1.297.414 2.03.699z"/></svg>'}static get sanitize(){return{s:{}}}},mk=Y_;var q_=class t{static get CSS(){return""}static get shortcut(){return"CMD+."}constructor(e){this.api=e.api,this.button=document.createElement("button"),this.iconClasses={base:this.api.styles.inlineToolButton,active:this.api.styles.inlineToolButtonActive}}static get isInline(){return!0}render(){return this.button?(this.button.type="button",this.button.classList.add(this.iconClasses.base),this.button.innerHTML=this.toolboxIcon,this.button):null}surround(e){if(!e)return;let n=this.api.selection.findParentTag("SUP",t.CSS);n?this.unwrap(n):this.wrap(e)}wrap(e){let n=document.createElement("SUP");n.appendChild(e.extractContents()),e.insertNode(n),this.api.selection.expandToTag(n)}unwrap(e){this.api.selection.expandToTag(e);let n=window.getSelection(),o=n.getRangeAt(0),r=o.extractContents();e.parentNode.removeChild(e),o.insertNode(r),n.removeAllRanges(),n.addRange(o)}checkState(){let e=this.api.selection.findParentTag("SUP",t.CSS);this.button.classList.toggle(this.iconClasses.active,!!e)}get toolboxIcon(){return'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" stroke-width="2" stroke="#2c3e50" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none" style="stroke: none !important" /><path d="M5 7l8 10m-8 0l8 -10" /><path d="M21 11h-4l3.5 -4a1.73 1.73 0 0 0 -3.5 -2" /></svg>'}static get sanitize(){return{sup:{}}}},_k=q_;var J_=class t{static get CSS(){return""}static get shortcut(){return"CMD+U"}constructor(e){this.api=e.api,this.button=document.createElement("button"),this.iconClasses={base:this.api.styles.inlineToolButton,active:this.api.styles.inlineToolButtonActive}}static get isInline(){return!0}render(){return this.button?(this.button.type="button",this.button.classList.add(this.iconClasses.base),this.button.innerHTML=this.toolboxIcon,this.button):null}surround(e){if(!e)return;let n=this.api.selection.findParentTag("U",t.CSS);n?this.unwrap(n):this.wrap(e)}wrap(e){let n=document.createElement("U");n.appendChild(e.extractContents()),e.insertNode(n),this.api.selection.expandToTag(n)}unwrap(e){this.api.selection.expandToTag(e);let n=window.getSelection(),o=n.getRangeAt(0),r=o.extractContents();e.parentNode.removeChild(e),o.insertNode(r),n.removeAllRanges(),n.addRange(o)}checkState(){let e=this.api.selection.findParentTag("U",t.CSS);this.button.classList.toggle(this.iconClasses.active,!!e)}get toolboxIcon(){return'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M9 7.5V11.5C9 12.2956 9.31607 13.0587 9.87868 13.6213C10.4413 14.1839 11.2044 14.5 12 14.5C12.7956 14.5 13.5587 14.1839 14.1213 13.6213C14.6839 13.0587 15 12.2956 15 11.5V7.5" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M7.71429 18H16.2857" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>'}static get sanitize(){return{u:{}}}},bk=J_;function yk(t){let e=Y(null),[n,o]=R(null),[r,i]=R({blocks:[{type:"paragraph",data:{}}],time:0,version:""}),s=t.placeholder||"Start typing...";return P(()=>{if(!n)return;let a=t.value;if(r?.time!==a?.time){let l=r?.time||0;(a?.time||0)>l&&z6(a)&&((a?.blocks||[]).length>0?n.render(a):n.render({...a,blocks:[{type:"paragraph",data:{text:""}}]}),i(a))}},[n,t.value]),P(()=>{let a=e.current,l=$u,c=new l({holder:a,placeholder:s,inlineToolbar:["bold","italic","underline","strikethrough","superscript","link"],tools:{heading:{class:qu,config:{placeholder:"Enter a header",levels:[2,3,4,5],defaultLevel:2}},strikethrough:{class:mk},superscript:{class:_k},underline:{class:bk},image:{class:Xu,config:{uploader:H6(),captionPlaceholder:"Alt text"}},unorderedList:{class:cc,inlineToolbar:!0,config:{defaultStyle:"unordered"},toolbox:{name:"unorderedList",title:"Bulleted List",icon:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><line x1="9" x2="19" y1="7" y2="7" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><line x1="9" x2="19" y1="12" y2="12" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><line x1="9" x2="19" y1="17" y2="17" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M5.00001 17H4.99002"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M5.00001 12H4.99002"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M5.00001 7H4.99002"/></svg>'}},orderedList:{class:cc,inlineToolbar:!0,config:{defaultStyle:"ordered"},toolbox:{name:"orderedList",title:"Numbered List",icon:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><line x1="12" x2="19" y1="7" y2="7" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><line x1="12" x2="19" y1="12" y2="12" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><line x1="12" x2="19" y1="17" y2="17" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M7.79999 14L7.79999 7.2135C7.79999 7.12872 7.7011 7.0824 7.63597 7.13668L4.79999 9.5"/></svg>'}},html:{class:Zu,toolbox:{name:"HTML"}}},onReady:()=>{o(c)},onChange:()=>{c.save().then(d=>{i(d),t.onChange&&t.onChange(d)}).catch(d=>{console.error("richtext error: ",d)})}});return()=>{c&&typeof c.destroy=="function"&&c.destroy()}},[]),g("div",{ref:e,className:Se(t.className,"EditorJSEditor")})}function z6(t){return Ws(t)&&Array.isArray(t.blocks)&&t.blocks.length>0}function H6(){return{uploadByFile:async t=>{try{let e=await Js(t),n=e.src;return K6(n)&&(n=`${n}=s0-e365`),console.log(e),{success:1,file:{...e,url:n}}}catch(e){return console.error(e),{success:0,error:e}}},uploadByUrl:async t=>({success:0,error:"upload by url not currently supported"})}}function K6(t){return t.startsWith("https://lh3.googleusercontent.com/")}var Ey={};Re(Ey,{$addUpdateTag:()=>O1,$applyNodeReplacement:()=>Ac,$caretFromPoint:()=>fi,$caretRangeFromSelection:()=>Pb,$cloneWithProperties:()=>F1,$comparePointCaretNext:()=>xy,$copyNode:()=>hy,$create:()=>yU,$createLineBreakNode:()=>Oa,$createNodeSelection:()=>Qb,$createParagraphNode:()=>Nr,$createPoint:()=>xo,$createRangeSelection:()=>a1,$createRangeSelectionFromDom:()=>UK,$createTabNode:()=>Op,$createTextNode:()=>Ut,$extendCaretToRange:()=>by,$getAdjacentChildCaret:()=>$a,$getAdjacentNode:()=>N1,$getAdjacentSiblingOrParentSiblingCaret:()=>kU,$getCaretInDirection:()=>hi,$getCaretRange:()=>pi,$getCaretRangeInDirection:()=>Cy,$getCharacterOffsets:()=>Nb,$getChildCaret:()=>Ir,$getChildCaretAtIndex:()=>V1,$getChildCaretOrSelf:()=>z1,$getCollapsedCaretRange:()=>H1,$getCommonAncestor:()=>_c,$getCommonAncestorResultBranchOrder:()=>vy,$getEditor:()=>gy,$getNearestNodeFromDOMNode:()=>Rp,$getNearestRootOrShadowRoot:()=>M1,$getNodeByKey:()=>Lt,$getNodeByKeyOrThrow:()=>A1,$getPreviousSelection:()=>gs,$getRoot:()=>On,$getSelection:()=>Fe,$getSiblingCaret:()=>Yt,$getState:()=>up,$getStateChange:()=>_K,$getTextContent:()=>WK,$getTextNodeOffset:()=>hs,$getTextPointCaret:()=>ui,$getTextPointCaretSlice:()=>Lb,$getWritableNodeState:()=>jb,$hasAncestor:()=>Tp,$hasUpdateTag:()=>fU,$insertNodes:()=>VK,$isBlockElementNode:()=>KK,$isChildCaret:()=>yo,$isDecoratorNode:()=>Ye,$isElementNode:()=>U,$isExtendableTextPointCaret:()=>j1,$isInlineElementOrDecoratorNode:()=>hU,$isLeafNode:()=>dU,$isLineBreakNode:()=>ss,$isNodeCaret:()=>CU,$isNodeSelection:()=>Ip,$isParagraphNode:()=>tU,$isRangeSelection:()=>de,$isRootNode:()=>Nn,$isRootOrShadowRoot:()=>vo,$isSiblingCaret:()=>fs,$isTabNode:()=>Zb,$isTextNode:()=>te,$isTextPointCaret:()=>Dr,$isTextPointCaretSlice:()=>SU,$isTokenOrSegmented:()=>wr,$isTokenOrTab:()=>si,$nodesOfType:()=>pU,$normalizeCaret:()=>_o,$normalizeSelection__EXPERIMENTAL:()=>pp,$onUpdate:()=>I1,$parseSerializedNode:()=>qK,$removeTextFromCaretRange:()=>U1,$rewindSiblingCaret:()=>Ua,$selectAll:()=>uU,$setCompositionKey:()=>Vt,$setPointFromCaret:()=>za,$setSelection:()=>In,$setSelectionFromCaretRange:()=>K1,$setState:()=>bK,$splitAtPointCaretNext:()=>OU,$splitNode:()=>gU,$updateRangeSelectionFromCaretRange:()=>bc,ArtificialNode__DO_NOT_USE:()=>Cp,BLUR_COMMAND:()=>WN,CAN_REDO_COMMAND:()=>OK,CAN_UNDO_COMMAND:()=>IK,CLEAR_EDITOR_COMMAND:()=>NK,CLEAR_HISTORY_COMMAND:()=>DK,CLICK_COMMAND:()=>NN,COLLABORATION_TAG:()=>h1,COMMAND_PRIORITY_CRITICAL:()=>sU,COMMAND_PRIORITY_EDITOR:()=>nU,COMMAND_PRIORITY_HIGH:()=>iU,COMMAND_PRIORITY_LOW:()=>oU,COMMAND_PRIORITY_NORMAL:()=>rU,CONTROLLED_TEXT_INSERTION_COMMAND:()=>wa,COPY_COMMAND:()=>qb,CUT_COMMAND:()=>Jb,DELETE_CHARACTER_COMMAND:()=>Tc,DELETE_LINE_COMMAND:()=>kc,DELETE_WORD_COMMAND:()=>Sc,DRAGEND_COMMAND:()=>jN,DRAGOVER_COMMAND:()=>UN,DRAGSTART_COMMAND:()=>KN,DROP_COMMAND:()=>HN,DecoratorNode:()=>Nc,ElementNode:()=>di,FOCUS_COMMAND:()=>VN,FORMAT_ELEMENT_COMMAND:()=>kK,FORMAT_TEXT_COMMAND:()=>ri,HISTORIC_TAG:()=>JK,HISTORY_MERGE_TAG:()=>ap,HISTORY_PUSH_TAG:()=>XK,INDENT_CONTENT_COMMAND:()=>TK,INSERT_LINE_BREAK_COMMAND:()=>fc,INSERT_PARAGRAPH_COMMAND:()=>yb,INSERT_TAB_COMMAND:()=>wK,INTERNAL_$isBlock:()=>kr,IS_ALL_FORMATTING:()=>fN,IS_BOLD:()=>Z6,IS_CODE:()=>eK,IS_HIGHLIGHT:()=>kp,IS_ITALIC:()=>Q6,IS_STRIKETHROUGH:()=>xc,IS_SUBSCRIPT:()=>tK,IS_SUPERSCRIPT:()=>nK,IS_UNDERLINE:()=>vc,KEY_ARROW_DOWN_COMMAND:()=>RN,KEY_ARROW_LEFT_COMMAND:()=>MN,KEY_ARROW_RIGHT_COMMAND:()=>ON,KEY_ARROW_UP_COMMAND:()=>LN,KEY_BACKSPACE_COMMAND:()=>FN,KEY_DELETE_COMMAND:()=>$N,KEY_DOWN_COMMAND:()=>DN,KEY_ENTER_COMMAND:()=>mp,KEY_ESCAPE_COMMAND:()=>BN,KEY_MODIFIER_COMMAND:()=>GN,KEY_SPACE_COMMAND:()=>PN,KEY_TAB_COMMAND:()=>zN,LineBreakNode:()=>Da,MOVE_TO_END:()=>IN,MOVE_TO_START:()=>AN,NODE_STATE_KEY:()=>dK,OUTDENT_CONTENT_COMMAND:()=>SK,PASTE_COMMAND:()=>Wb,PASTE_TAG:()=>ZK,ParagraphNode:()=>Aa,REDO_COMMAND:()=>Yb,REMOVE_TEXT_COMMAND:()=>xb,RootNode:()=>Ma,SELECTION_CHANGE_COMMAND:()=>Vb,SELECTION_INSERT_CLIPBOARD_NODES_COMMAND:()=>EK,SELECT_ALL_COMMAND:()=>vb,SKIP_COLLAB_TAG:()=>QK,SKIP_DOM_SELECTION_TAG:()=>m1,SKIP_SCROLL_INTO_VIEW_TAG:()=>g1,TEXT_TYPE_TO_FORMAT:()=>ln,TabNode:()=>Ia,TextNode:()=>ds,UNDO_COMMAND:()=>Gb,buildImportMap:()=>LK,createCommand:()=>xe,createEditor:()=>aU,createSharedNodeState:()=>xN,createState:()=>mK,flipDirection:()=>gi,getDOMOwnerDocument:()=>py,getDOMSelection:()=>Vo,getDOMSelectionFromTarget:()=>L1,getDOMTextNode:()=>ps,getEditorPropertyFromDOMNode:()=>Ic,getNearestEditorFromDOMNode:()=>ay,getRegisteredNode:()=>iy,getRegisteredNodeOrThrow:()=>ry,isBlockDomNode:()=>Mb,isCurrentlyReadOnlyMode:()=>Ha,isDOMDocumentNode:()=>y1,isDOMNode:()=>Ka,isDOMTextNode:()=>Wo,isDOMUnmanaged:()=>$1,isDocumentFragment:()=>R1,isExactShortcutMatch:()=>je,isHTMLAnchorElement:()=>mU,isHTMLElement:()=>yn,isInlineDomNode:()=>P1,isLexicalEditor:()=>Ap,isModifierMatch:()=>k1,isSelectionCapturedInDecoratorInput:()=>sy,isSelectionWithinEditor:()=>Oc,makeStepwiseIterator:()=>yy,removeFromParent:()=>ai,resetRandomKey:()=>lU,setDOMUnmanaged:()=>bU,setNodeIndentFromDOM:()=>B1});function V(t,...e){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",t);for(let r of e)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var Co=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,U6=Co&&"documentMode"in document?document.documentMode:null,jo=Co&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),as=Co&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),lp=!(!Co||!("InputEvent"in window)||U6)&&"getTargetRanges"in new window.InputEvent("input"),yc=Co&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),ka=Co&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,j6=Co&&/Android/.test(navigator.userAgent),uN=Co&&/^(?=.*Chrome).*/i.test(navigator.userAgent),xk=Co&&j6&&uN,cp=Co&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!uN;function dp(...t){let e=[];for(let n of t)if(n&&typeof n=="string")for(let[o]of n.matchAll(/\S+/g))e.push(o);return e}var V6=1,W6=3,G6=9,Y6=11,ls=0,pN=1,Na=2,q6=0,J6=1,X6=2,Z6=1,Q6=2,xc=4,vc=8,eK=16,tK=32,nK=64,kp=128,fN=1792|(112|(3|xc|vc)|kp),Fb=1,Bb=2,$b=3,zb=4,Hb=5,Kb=6,Np=yc||ka||cp?"\xA0":"\u200B",Or=`
|
|
104
|
-
|
|
105
|
-
`,oK=as?"\xA0":Np,hN="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",gN="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",rK=new RegExp("^[^"+gN+"]*["+hN+"]"),iK=new RegExp("^[^"+hN+"]*["+gN+"]"),ln={bold:1,capitalize:1024,code:16,highlight:kp,italic:2,lowercase:256,strikethrough:xc,subscript:32,superscript:64,underline:vc,uppercase:512},sK={directionless:1,unmergeable:2},vk={center:Bb,end:Kb,justify:zb,left:Fb,right:$b,start:Hb},aK={[Bb]:"center",[Kb]:"end",[zb]:"justify",[Fb]:"left",[$b]:"right",[Hb]:"start"},lK={normal:0,segmented:2,token:1},cK={[q6]:"normal",[X6]:"segmented",[J6]:"token"},dK="$",Ck="$config";function mN(t,e,n,o,r,i){let s=t.getFirstChild();for(;s!==null;){let a=s.__key;s.__parent===e&&(U(s)&&mN(s,a,n,o,r,i),n.has(a)||i.delete(a),r.push(a)),s=s.getNextSibling()}}var uK=100,db=!1,Ub=0;function pK(t){Ub=t.timeStamp}function X_(t,e,n){let o=t.nodeName==="BR",r=e.__lexicalLineBreak;return r&&(t===r||o&&t.previousSibling===r)||o&&Lp(t,n)!==void 0}function fK(t,e,n){let o=Vo(co(n)),r=null,i=null;o!==null&&o.anchorNode===t&&(r=o.anchorOffset,i=o.focusOffset);let s=t.nodeValue;s!==null&&dy(e,s,r,i,!1)}function hK(t,e,n){if(de(t)){let o=t.anchor.getNode();if(o.is(n)&&t.format!==o.getFormat())return!1}return Wo(e)&&n.isAttached()}function gK(t,e,n,o){for(let r=t;r&&!$1(r);r=Mc(r)){let i=Lp(r,e);if(i!==void 0){let s=Lt(i,n);if(s)return Ye(s)||!yn(r)?void 0:[r,s]}else if(r===o)return[o,E1(n)]}}function _N(t,e,n){db=!0;let o=performance.now()-Ub>uK;try{Yn(t,(()=>{let r=Fe()||(function(p){return p.getEditorState().read((()=>{let f=Fe();return f!==null?f.clone():null}))})(t),i=new Map,s=t.getRootElement(),a=t._editorState,l=t._blockCursorElement,c=!1,d="";for(let p=0;p<e.length;p++){let f=e[p],h=f.type,m=f.target,_=gK(m,t,a,s);if(!_)continue;let[b,y]=_;if(h==="characterData")o&&te(y)&&Wo(m)&&hK(r,m,y)&&fK(m,y,t);else if(h==="childList"){c=!0;let x=f.addedNodes;for(let C=0;C<x.length;C++){let k=x[C],T=v1(k),w=k.parentNode;if(w!=null&&k!==l&&T===null&&!X_(k,w,t)){if(as){let S=(yn(k)?k.innerText:null)||k.nodeValue;S&&(d+=S)}w.removeChild(k)}}let v=f.removedNodes,E=v.length;if(E>0){let C=0;for(let k=0;k<E;k++){let T=v[k];(X_(T,m,t)||l===T)&&(m.appendChild(T),C++)}E!==C&&i.set(b,y)}}}if(i.size>0)for(let[p,f]of i)f.reconcileObservedMutation(p,t);let u=n.takeRecords();if(u.length>0){for(let p=0;p<u.length;p++){let f=u[p],h=f.addedNodes,m=f.target;for(let _=0;_<h.length;_++){let b=h[_],y=b.parentNode;y==null||b.nodeName!=="BR"||X_(b,m,t)||y.removeChild(b)}}n.takeRecords()}r!==null&&(c&&In(r),as&&D1(t)&&r.insertRawText(d))}))}finally{db=!1}}function bN(t){let e=t._observer;e!==null&&_N(t,e.takeRecords(),e)}function yN(t){(function(e){Ub===0&&co(e).addEventListener("textInput",pK,!0)})(t),t._observer=new MutationObserver(((e,n)=>{_N(t,e,n)}))}var ub=class{constructor(e,n){this.key=e,this.parse=n.parse.bind(n),this.unparse=(n.unparse||yK).bind(n),this.isEqual=(n.isEqual||Object.is).bind(n),this.defaultValue=this.parse(void 0)}};function mK(t,e){return new ub(t,e)}function up(t,e,n="latest"){let o=(n==="latest"?t.getLatest():t).__state;return o?o.getValue(e):e.defaultValue}function _K(t,e,n){let o=up(t,n,"direct"),r=up(e,n,"direct");return n.isEqual(o,r)?null:[o,r]}function bK(t,e,n){let o;if(jt(),typeof n=="function"){let i=t.getLatest(),s=up(i,e);if(o=n(s),e.isEqual(s,o))return i}else o=n;let r=t.getWritable();return jb(r).updateFromKnown(e,o),r}function xN(t){let e=new Map,n=new Set;for(let o=typeof t=="function"?t:t.replace;o.prototype&&o.prototype.getType!==void 0;o=Object.getPrototypeOf(o)){let{ownNodeConfig:r}=my(o);if(r&&r.stateConfigs)for(let i of r.stateConfigs){let s;"stateConfig"in i?(s=i.stateConfig,i.flat&&n.add(s.key)):s=i,e.set(s.key,s)}}return{flatKeys:n,sharedConfigMap:e}}var pb=class t{constructor(e,n,o=void 0,r=new Map,i=void 0){this.node=e,this.sharedNodeState=n,this.unknownState=o,this.knownState=r;let{sharedConfigMap:s}=this.sharedNodeState,a=i!==void 0?i:(function(l,c,d){let u=d.size;if(c)for(let p in c){let f=l.get(p);f&&d.has(f)||u++}return u})(s,o,r);this.size=a}getValue(e){let n=this.knownState.get(e);if(n!==void 0)return n;this.sharedNodeState.sharedConfigMap.set(e.key,e);let o=e.defaultValue;if(this.unknownState&&e.key in this.unknownState){let r=this.unknownState[e.key];r!==void 0&&(o=e.parse(r)),this.updateFromKnown(e,o)}return o}getInternalState(){return[this.unknownState,this.knownState]}toJSON(){let e={...this.unknownState},n={};for(let[o,r]of this.knownState)o.isEqual(r,o.defaultValue)?delete e[o.key]:e[o.key]=o.unparse(r);for(let o of this.sharedNodeState.flatKeys)o in e&&(n[o]=e[o],delete e[o]);return Ek(e)&&(n.$=e),n}getWritable(e){if(this.node===e)return this;let{sharedNodeState:n,unknownState:o}=this,r=new Map(this.knownState);return new t(e,n,(function(i,s,a){let l;if(a)for(let[c,d]of Object.entries(a)){let u=i.get(c);u?s.has(u)||s.set(u,u.parse(d)):(l=l||{},l[c]=d)}return l})(n.sharedConfigMap,r,o),r,this.size)}updateFromKnown(e,n){let o=e.key;this.sharedNodeState.sharedConfigMap.set(o,e);let{knownState:r,unknownState:i}=this;r.has(e)||i&&o in i||(i&&(delete i[o],this.unknownState=Ek(i)),this.size++),r.set(e,n)}updateFromUnknown(e,n){let o=this.sharedNodeState.sharedConfigMap.get(e);o?this.updateFromKnown(o,o.parse(n)):(this.unknownState=this.unknownState||{},e in this.unknownState||this.size++,this.unknownState[e]=n)}updateFromJSON(e){let{knownState:n}=this;for(let o of n.keys())n.set(o,o.defaultValue);if(this.size=n.size,this.unknownState=void 0,e)for(let[o,r]of Object.entries(e))this.updateFromUnknown(o,r)}};function jb(t){let e=t.getWritable(),n=e.__state?e.__state.getWritable(e):new pb(e,vN(e));return e.__state=n,n}function vN(t){return t.__state?t.__state.sharedNodeState:ry(gy(),t.getType()).sharedNodeState}function Ek(t){if(t)for(let e in t)return t}function yK(t){return t}function wk(t,e,n){for(let[o,r]of e.knownState){if(t.has(o.key))continue;t.add(o.key);let i=n?n.getValue(o):o.defaultValue;if(i!==r&&!o.isEqual(i,r))return!0}return!1}function Tk(t,e,n){let{unknownState:o}=e,r=n?n.unknownState:void 0;if(o){for(let[i,s]of Object.entries(o))if(!t.has(i)&&(t.add(i),s!==(r?r[i]:void 0)))return!0}return!1}function Sk(t,e){let n=t.__state;return n&&n.node===t?n.getWritable(e):n}function kk(t,e){let n=t.__mode,o=t.__format,r=t.__style,i=e.__mode,s=e.__format,a=e.__style,l=t.__state,c=e.__state;return(n===null||n===i)&&(o===null||o===s)&&(r===null||r===a)&&(t.__state===null||l===c||(function(d,u){if(d===u)return!0;if(d&&u&&d.size!==u.size)return!1;let p=new Set;return!(d&&wk(p,d,u)||u&&wk(p,u,d)||d&&Tk(p,d,u)||u&&Tk(p,u,d))})(l,c))}function Nk(t,e){let n=t.mergeWithSibling(e),o=nt()._normalizedNodes;return o.add(t.__key),o.add(e.__key),n}function Dk(t){let e,n,o=t;if(o.__text!==""||!o.isSimpleText()||o.isUnmergeable()){for(;(e=o.getPreviousSibling())!==null&&te(e)&&e.isSimpleText()&&!e.isUnmergeable();){if(e.__text!==""){if(kk(e,o)){o=Nk(e,o);break}break}e.remove()}for(;(n=o.getNextSibling())!==null&&te(n)&&n.isSimpleText()&&!n.isUnmergeable();){if(n.__text!==""){if(kk(o,n)){o=Nk(o,n);break}break}n.remove()}}else o.remove()}function pp(t){return Ok(t.anchor),Ok(t.focus),t}function Ok(t){for(;t.type==="element";){let e=t.getNode(),n=t.offset,o,r;if(n===e.getChildrenSize()?(o=e.getChildAtIndex(n-1),r=!0):(o=e.getChildAtIndex(n),r=!1),te(o)){t.set(o.__key,r?o.getTextContentSize():0,"text",!0);break}if(!U(o))break;t.set(o.__key,r?o.getChildrenSize():0,"element",!0)}}var li,bn,Cc,Dp,fb,hb,cs,bo,gb,Ec,At="",_n="",Ko=null,Uo="",Tr="",CN=!1,wc=!1,rp=null;function fp(t,e){let n=cs.get(t);if(e!==null){let o=bb(t);o.parentNode===e&&e.removeChild(o)}if(bo.has(t)||bn._keyToDOMMap.delete(t),U(n)){let o=gp(n,cs);mb(o,0,o.length-1,null)}n!==void 0&&uy(Ec,Cc,Dp,n,"destroyed")}function mb(t,e,n,o){let r=e;for(;r<=n;++r){let i=t[r];i!==void 0&&fp(i,o)}}function rs(t,e){t.setProperty("text-align",e)}var xK="40px";function EN(t,e){let n=li.theme.indent;if(typeof n=="string"){let r=t.classList.contains(n);e>0&&!r?t.classList.add(n):e<1&&r&&t.classList.remove(n)}let o=getComputedStyle(t).getPropertyValue("--lexical-indent-base-value")||xK;t.style.setProperty("padding-inline-start",e===0?"":`calc(${e} * ${o})`)}function wN(t,e){let n=t.style;e===0?rs(n,""):e===Fb?rs(n,"left"):e===Bb?rs(n,"center"):e===$b?rs(n,"right"):e===zb?rs(n,"justify"):e===Hb?rs(n,"start"):e===Kb&&rs(n,"end")}function hp(t,e){let n=bo.get(t);n===void 0&&V(60);let o=n.createDOM(li,bn);if((function(r,i,s){let a=s._keyToDOMMap;(function(l,c,d){let u=`__lexicalKey_${c._key}`;l[u]=d})(i,s,r),a.set(r,i)})(t,o,bn),te(n)?o.setAttribute("data-lexical-text","true"):Ye(n)&&o.setAttribute("data-lexical-decorator","true"),U(n)){let r=n.__indent,i=n.__size;if(r!==0&&EN(o,r),i!==0){let a=i-1;(function(l,c,d,u){let p=_n;_n="",_b(l,d,0,c,d.getDOMSlot(u)),SN(d,u),_n=p})(gp(n,bo),a,n,o)}let s=n.__format;s!==0&&wN(o,s),n.isInline()||TN(null,n,o),Pp(n)&&(At+=Or,Tr+=Or)}else{let r=n.getTextContent();if(Ye(n)){let i=n.decorate(bn,li);i!==null&&kN(t,i),o.contentEditable="false"}else te(n)&&(n.isDirectionless()||(_n+=r));At+=r,Tr+=r}return e!==null&&e.insertChild(o),uy(Ec,Cc,Dp,n,"created"),o}function _b(t,e,n,o,r){let i=At;At="";let s=n;for(;s<=o;++s){hp(t[s],r);let a=bo.get(t[s]);a!==null&&te(a)&&(Ko===null&&(Ko=a.getFormat()),Uo===""&&(Uo=a.getStyle()))}Pp(e)&&(At+=Or),r.element.__lexicalTextContent=At,At=i+At}function Ik(t,e){if(t){let n=t.__last;if(n){let o=e.get(n);if(o)return ss(o)?"line-break":Ye(o)&&o.isInline()?"decorator":null}return"empty"}return null}function TN(t,e,n){let o=Ik(t,cs),r=Ik(e,bo);o!==r&&e.getDOMSlot(n).setManagedLineBreak(r)}function SN(t,e){let n=e.__lexicalDirTextContent||"",o=e.__lexicalDir||"";if(n!==_n||o!==rp){let r=_n==="",i=r?rp:(function(s){return rK.test(s)?"rtl":iK.test(s)?"ltr":null})(_n);if(i!==o){let s=e.classList,a=li.theme,l=o!==null?a[o]:void 0,c=i!==null?a[i]:void 0;if(l!==void 0){if(typeof l=="string"){let d=dp(l);l=a[o]=d}s.remove(...l)}if(i===null||r&&i==="ltr")e.removeAttribute("dir");else{if(c!==void 0){if(typeof c=="string"){let d=dp(c);c=a[i]=d}c!==void 0&&s.add(...c)}e.dir=i}wc||(t.getWritable().__dir=i)}rp=i,e.__lexicalDirTextContent=_n,e.__lexicalDir=i}}function vK(t,e,n){let o=_n;var r;_n="",Ko=null,Uo="",(function(i,s,a){let l=At,c=i.__size,d=s.__size;At="";let u=a.element;if(c===1&&d===1){let p=i.__first,f=s.__first;if(p===f)pc(p,u);else{let m=bb(p),_=hp(f,null);try{u.replaceChild(_,m)}catch(b){if(typeof b=="object"&&b!=null){let y=`${b.toString()} Parent: ${u.tagName}, new child: {tag: ${_.tagName} key: ${f}}, old child: {tag: ${m.tagName}, key: ${p}}.`;throw new Error(y)}throw b}fp(p,null)}let h=bo.get(f);te(h)&&(Ko===null&&(Ko=h.getFormat()),Uo===""&&(Uo=h.getStyle()))}else{let p=gp(i,cs),f=gp(s,bo);if(p.length!==c&&V(227),f.length!==d&&V(228),c===0)d!==0&&_b(f,s,0,d-1,a);else if(d===0){if(c!==0){let h=a.after==null&&a.before==null&&a.element.__lexicalLineBreak==null;mb(p,0,c-1,h?null:u),h&&(u.textContent="")}}else(function(h,m,_,b,y,x){let v=b-1,E=y-1,C,k,T=x.getFirstChild(),w=0,S=0;for(;w<=v&&S<=E;){let O=m[w],M=_[S];if(O===M)T=Z_(pc(M,x.element)),w++,S++;else{C===void 0&&(C=new Set(m)),k===void 0&&(k=new Set(_));let L=k.has(O),K=C.has(M);if(L)if(K){let W=Ra(bn,M);W===T?T=Z_(pc(M,x.element)):(x.withBefore(T).insertChild(W),pc(M,x.element)),w++,S++}else hp(M,x.withBefore(T)),S++;else T=Z_(bb(O)),fp(O,x.element),w++}let I=bo.get(M);I!==null&&te(I)&&(Ko===null&&(Ko=I.getFormat()),Uo===""&&(Uo=I.getStyle()))}let N=w>v,D=S>E;if(N&&!D){let O=_[E+1],M=O===void 0?null:bn.getElementByKey(O);_b(_,h,S,E,x.withBefore(M))}else D&&!N&&mb(m,w,v,x.element)})(s,p,f,c,d,a)}Pp(s)&&(At+=Or),u.__lexicalTextContent=At,At=l+At})(t,e,e.getDOMSlot(n)),SN(e,n),r=e,Ko==null||Ko===r.__textFormat||wc||r.setTextFormat(Ko),(function(i){Uo===""||Uo===i.__textStyle||wc||i.setTextStyle(Uo)})(e),_n=o}function gp(t,e){let n=[],o=t.__first;for(;o!==null;){let r=e.get(o);r===void 0&&V(101),n.push(o),o=r.__next}return n}function pc(t,e){let n=cs.get(t),o=bo.get(t);n!==void 0&&o!==void 0||V(61);let r=CN||hb.has(t)||fb.has(t),i=Ra(bn,t);if(n===o&&!r){if(U(n)){let s=i.__lexicalTextContent;s!==void 0&&(At+=s,Tr+=s);let a=i.__lexicalDirTextContent;a!==void 0&&(_n+=a)}else{let s=n.getTextContent();te(n)&&!n.isDirectionless()&&(_n+=s),Tr+=s,At+=s}return i}if(n!==o&&r&&uy(Ec,Cc,Dp,o,"updated"),o.updateDOM(n,i,li)){let s=hp(t,null);return e===null&&V(62),e.replaceChild(s,i),fp(t,null),s}if(U(n)&&U(o)){let s=o.__indent;s!==n.__indent&&EN(i,s);let a=o.__format;a!==n.__format&&wN(i,a),r&&(vK(n,o,i),Nn(o)||o.isInline()||TN(n,o,i)),Pp(o)&&(At+=Or,Tr+=Or)}else{let s=o.getTextContent();if(Ye(o)){let a=o.decorate(bn,li);a!==null&&kN(t,a)}else te(o)&&!o.isDirectionless()&&(_n+=s);At+=s,Tr+=s}if(!wc&&Nn(o)&&o.__cachedText!==Tr){let s=o.getWritable();s.__cachedText=Tr,o=s}return i}function kN(t,e){let n=bn._pendingDecorators,o=bn._decorators;if(n===null){if(o[t]===e)return;n=C1(bn)}n[t]=e}function Z_(t){let e=t.nextSibling;return e!==null&&e===bn._blockCursorElement&&(e=e.nextSibling),e}function CK(t,e,n,o,r,i){At="",Tr="",_n="",CN=o===Na,rp=null,bn=n,li=n._config,Cc=n._nodes,Dp=bn._listeners.mutation,fb=r,hb=i,cs=t._nodeMap,bo=e._nodeMap,wc=e._readOnly,gb=new Map(n._keyToDOMMap);let s=new Map;return Ec=s,pc("root",null),bn=void 0,Cc=void 0,fb=void 0,hb=void 0,cs=void 0,bo=void 0,li=void 0,gb=void 0,Ec=void 0,s}function bb(t){let e=gb.get(t);return e===void 0&&V(75,t),e}function xe(t){return{type:t}}var Vb=xe("SELECTION_CHANGE_COMMAND"),EK=xe("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),NN=xe("CLICK_COMMAND"),Tc=xe("DELETE_CHARACTER_COMMAND"),fc=xe("INSERT_LINE_BREAK_COMMAND"),yb=xe("INSERT_PARAGRAPH_COMMAND"),wa=xe("CONTROLLED_TEXT_INSERTION_COMMAND"),Wb=xe("PASTE_COMMAND"),xb=xe("REMOVE_TEXT_COMMAND"),Sc=xe("DELETE_WORD_COMMAND"),kc=xe("DELETE_LINE_COMMAND"),ri=xe("FORMAT_TEXT_COMMAND"),Gb=xe("UNDO_COMMAND"),Yb=xe("REDO_COMMAND"),DN=xe("KEYDOWN_COMMAND"),ON=xe("KEY_ARROW_RIGHT_COMMAND"),IN=xe("MOVE_TO_END"),MN=xe("KEY_ARROW_LEFT_COMMAND"),AN=xe("MOVE_TO_START"),LN=xe("KEY_ARROW_UP_COMMAND"),RN=xe("KEY_ARROW_DOWN_COMMAND"),mp=xe("KEY_ENTER_COMMAND"),PN=xe("KEY_SPACE_COMMAND"),FN=xe("KEY_BACKSPACE_COMMAND"),BN=xe("KEY_ESCAPE_COMMAND"),$N=xe("KEY_DELETE_COMMAND"),zN=xe("KEY_TAB_COMMAND"),wK=xe("INSERT_TAB_COMMAND"),TK=xe("INDENT_CONTENT_COMMAND"),SK=xe("OUTDENT_CONTENT_COMMAND"),HN=xe("DROP_COMMAND"),kK=xe("FORMAT_ELEMENT_COMMAND"),KN=xe("DRAGSTART_COMMAND"),UN=xe("DRAGOVER_COMMAND"),jN=xe("DRAGEND_COMMAND"),qb=xe("COPY_COMMAND"),Jb=xe("CUT_COMMAND"),vb=xe("SELECT_ALL_COMMAND"),NK=xe("CLEAR_EDITOR_COMMAND"),DK=xe("CLEAR_HISTORY_COMMAND"),OK=xe("CAN_REDO_COMMAND"),IK=xe("CAN_UNDO_COMMAND"),VN=xe("FOCUS_COMMAND"),WN=xe("BLUR_COMMAND"),GN=xe("KEY_MODIFIER_COMMAND"),vr=Object.freeze({}),Cb=30,Eb=[["keydown",function(t,e){if(hc=t.timeStamp,YN=t.key,!e.isComposing()&&!Z(e,DN,t)&&t.key!=null){if(Q_&&iN(t))return Yn(e,(()=>{Qu(e,eb)})),Q_=!1,void(eb="");if((function(n){return je(n,"ArrowRight",{shiftKey:"any"})})(t))Z(e,ON,t);else if((function(n){return je(n,"ArrowRight",Er)})(t))Z(e,IN,t);else if((function(n){return je(n,"ArrowLeft",{shiftKey:"any"})})(t))Z(e,MN,t);else if((function(n){return je(n,"ArrowLeft",Er)})(t))Z(e,AN,t);else if((function(n){return je(n,"ArrowUp",{altKey:"any",shiftKey:"any"})})(t))Z(e,LN,t);else if((function(n){return je(n,"ArrowDown",{altKey:"any",shiftKey:"any"})})(t))Z(e,RN,t);else if((function(n){return je(n,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any",shiftKey:!0})})(t))gc=!0,Z(e,mp,t);else if((function(n){return n.key===" "})(t))Z(e,PN,t);else if((function(n){return jo&&je(n,"o",{ctrlKey:!0})})(t))t.preventDefault(),gc=!0,Z(e,fc,!0);else if((function(n){return je(n,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any"})})(t))gc=!1,Z(e,mp,t);else if((function(n){return je(n,"Backspace",{shiftKey:"any"})||jo&&je(n,"h",{ctrlKey:!0})})(t))iN(t)?Z(e,FN,t):(t.preventDefault(),Z(e,Tc,!0));else if((function(n){return n.key==="Escape"})(t))Z(e,BN,t);else if((function(n){return je(n,"Delete",{})||jo&&je(n,"d",{ctrlKey:!0})})(t))(function(n){return n.key==="Delete"})(t)?Z(e,$N,t):(t.preventDefault(),Z(e,Tc,!1));else if((function(n){return je(n,"Backspace",rN)})(t))t.preventDefault(),Z(e,Sc,!0);else if((function(n){return je(n,"Delete",rN)})(t))t.preventDefault(),Z(e,Sc,!1);else if((function(n){return jo&&je(n,"Backspace",{metaKey:!0})})(t))t.preventDefault(),Z(e,kc,!0);else if((function(n){return jo&&(je(n,"Delete",{metaKey:!0})||je(n,"k",{ctrlKey:!0}))})(t))t.preventDefault(),Z(e,kc,!1);else if((function(n){return je(n,"b",Er)})(t))t.preventDefault(),Z(e,ri,"bold");else if((function(n){return je(n,"u",Er)})(t))t.preventDefault(),Z(e,ri,"underline");else if((function(n){return je(n,"i",Er)})(t))t.preventDefault(),Z(e,ri,"italic");else if((function(n){return je(n,"Tab",{shiftKey:"any"})})(t))Z(e,zN,t);else if((function(n){return je(n,"z",Er)})(t))t.preventDefault(),Z(e,Gb,void 0);else if((function(n){return jo?je(n,"z",{metaKey:!0,shiftKey:!0}):je(n,"y",{ctrlKey:!0})||je(n,"z",{ctrlKey:!0,shiftKey:!0})})(t))t.preventDefault(),Z(e,Yb,void 0);else{let n=e._editorState._selection;n===null||de(n)?sN(t)&&(t.preventDefault(),Z(e,vb,t)):(function(o){return je(o,"c",Er)})(t)?(t.preventDefault(),Z(e,qb,t)):(function(o){return je(o,"x",Er)})(t)?(t.preventDefault(),Z(e,Jb,t)):sN(t)&&(t.preventDefault(),Z(e,vb,t))}(function(n){return n.ctrlKey||n.shiftKey||n.altKey||n.metaKey})(t)&&Z(e,GN,t)}}],["pointerdown",function(t,e){let n=t.target,o=t.pointerType;Ka(n)&&o!=="touch"&&o!=="pen"&&t.button===0&&Yn(e,(()=>{tN(n)||(Tb=!0)}))}],["compositionstart",function(t,e){Yn(e,(()=>{let n=Fe();if(de(n)&&!e.isComposing()){let o=n.anchor,r=n.anchor.getNode();Vt(o.key),(t.timeStamp<hc+Cb||o.type==="element"||!n.isCollapsed()||r.getFormat()!==n.format||te(r)&&r.getStyle()!==n.style)&&Z(e,wa,oK)}}))}],["compositionend",function(t,e){as?dc=!0:ka||!yc&&!cp?Yn(e,(()=>{Qu(e,t.data)})):(Q_=!0,eb=t.data)}],["input",function(t,e){t.stopPropagation(),Yn(e,(()=>{if(yn(t.target)&&tN(t.target))return;let n=Fe(),o=t.data,r=QN(t);if(o!=null&&de(n)&&XN(n,r,o,t.timeStamp,!1)){dc&&(Qu(e,o),dc=!1);let i=n.anchor.getNode(),s=Vo(co(e));if(s===null)return;let a=n.isBackward(),l=a?n.anchor.offset:n.focus.offset,c=a?n.focus.offset:n.anchor.offset;lp&&!n.isCollapsed()&&te(i)&&s.anchorNode!==null&&i.getTextContent().slice(0,l)+o+i.getTextContent().slice(l+c)===S1(s.anchorNode)||Z(e,wa,o);let d=o.length;as&&d>1&&t.inputType==="insertCompositionText"&&!e.isComposing()&&(n.anchor.offset-=d),yc||ka||cp||!e.isComposing()||(hc=0,Vt(null))}else cy(!1,e,o!==null?o:void 0),dc&&(Qu(e,o||void 0),dc=!1);(function(){jt();let i=nt();bN(i)})()}),{event:t}),Ca=null}],["click",function(t,e){Yn(e,(()=>{let n=Fe(),o=Vo(co(e)),r=gs();if(o){if(de(n)){let i=n.anchor,s=i.getNode();if(i.type==="element"&&i.offset===0&&n.isCollapsed()&&!Nn(s)&&On().getChildrenSize()===1&&s.getTopLevelElementOrThrow().isEmpty()&&r!==null&&n.is(r))o.removeAllRanges(),n.dirty=!0;else if(t.detail===3&&!n.isCollapsed()&&s!==n.focus.getNode()){let a=(function(l,c){let d=l;for(;d!==On()&&d!=null;){if(c(d))return d;d=d.getParent()}return null})(s,(l=>U(l)&&!l.isInline()));U(a)&&a.select(0)}}else if(t.pointerType==="touch"||t.pointerType==="pen"){let i=o.anchorNode;(yn(i)||Wo(i))&&In(Mp(r,o,e,t))}}Z(e,NN,t)}))}],["cut",vr],["copy",vr],["dragstart",vr],["dragover",vr],["dragend",vr],["paste",vr],["focus",vr],["blur",vr],["drop",vr]];lp&&Eb.push(["beforeinput",(t,e)=>(function(n,o){let r=n.inputType,i=QN(n);r==="deleteCompositionText"||as&&D1(o)||r!=="insertCompositionText"&&Yn(o,(()=>{let s=Fe();if(r==="deleteContentBackward"){if(s===null){let f=gs();if(!de(f))return;In(f.clone())}if(de(s)){let f=s.anchor.key===s.focus.key;if(a=n.timeStamp,YN==="MediaLast"&&a<hc+Cb&&o.isComposing()&&f){if(Vt(null),hc=0,setTimeout((()=>{Yn(o,(()=>{Vt(null)}))}),Cb),de(s)){let h=s.anchor.getNode();h.markDirty(),te(h)||V(142),ZN(s,h)}}else{Vt(null),n.preventDefault();let h=s.anchor.getNode(),m=h.getTextContent(),_=h.canInsertTextAfter(),b=s.anchor.offset===0&&s.focus.offset===m.length,y=xk&&f&&!b&&_;if(y&&s.isCollapsed()&&(y=!Ye(N1(s.anchor,!0))),!y){Z(o,Tc,!0);let x=Fe();xk&&de(x)&&x.isCollapsed()&&(is=x,setTimeout((()=>is=null)))}}return}}var a;if(!de(s))return;let l=n.data;Ca!==null&&cy(!1,o,Ca),s.dirty&&Ca===null||!s.isCollapsed()||Nn(s.anchor.getNode())||i===null||s.applyDOMRange(i),Ca=null;let c=s.anchor,d=s.focus,u=c.getNode(),p=d.getNode();if(r!=="insertText"&&r!=="insertTranspose")switch(n.preventDefault(),r){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":Z(o,wa,n);break;case"insertFromComposition":Vt(null),Z(o,wa,n);break;case"insertLineBreak":Vt(null),Z(o,fc,!1);break;case"insertParagraph":Vt(null),gc&&!ka?(gc=!1,Z(o,fc,!1)):Z(o,yb,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":Z(o,Wb,n);break;case"deleteByComposition":(function(f,h){return f!==h||U(f)||U(h)||!si(f)||!si(h)})(u,p)&&Z(o,xb,n);break;case"deleteByDrag":case"deleteByCut":Z(o,xb,n);break;case"deleteContent":Z(o,Tc,!1);break;case"deleteWordBackward":Z(o,Sc,!0);break;case"deleteWordForward":Z(o,Sc,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":Z(o,kc,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":Z(o,kc,!1);break;case"formatStrikeThrough":Z(o,ri,"strikethrough");break;case"formatBold":Z(o,ri,"bold");break;case"formatItalic":Z(o,ri,"italic");break;case"formatUnderline":Z(o,ri,"underline");break;case"historyUndo":Z(o,Gb,void 0);break;case"historyRedo":Z(o,Yb,void 0)}else{if(l===`
|
|
106
|
-
`)n.preventDefault(),Z(o,fc,!1);else if(l===Or)n.preventDefault(),Z(o,yb,void 0);else if(l==null&&n.dataTransfer){let f=n.dataTransfer.getData("text/plain");n.preventDefault(),s.insertRawText(f)}else l!=null&&XN(s,i,l,n.timeStamp,!0)?(n.preventDefault(),Z(o,wa,l)):Ca=l;qN=n.timeStamp}}))})(t,e)]);var hc=0,YN=null,qN=0,Ca=null,_p=new WeakMap,wb=!1,Tb=!1,gc=!1,dc=!1,Q_=!1,eb="",is=null,JN=[0,"",0,"root",0];function XN(t,e,n,o,r){let i=t.anchor,s=t.focus,a=i.getNode(),l=nt(),c=Vo(co(l)),d=c!==null?c.anchorNode:null,u=i.key,p=l.getElementByKey(u),f=n.length;return u!==s.key||!te(a)||(!r&&(!lp||qN<o+50)||a.isDirty()&&f<2||w1(n))&&i.offset!==s.offset&&!a.isComposing()||wr(a)||a.isDirty()&&f>1||(r||!lp)&&p!==null&&!a.isComposing()&&d!==ps(p)||c!==null&&e!==null&&(!e.collapsed||e.startContainer!==c.anchorNode||e.startOffset!==c.anchorOffset)||a.getFormat()!==t.format||a.getStyle()!==t.style||(function(h,m){if(m.isSegmented())return!0;if(!h.isCollapsed())return!1;let _=h.anchor.offset,b=m.getParentOrThrow(),y=si(m);return _===0?!m.canInsertTextBefore()||!b.canInsertTextBefore()&&!m.isComposing()||y||(function(x){let v=x.getPreviousSibling();return(te(v)||U(v)&&v.isInline())&&!v.canInsertTextAfter()})(m):_===m.getTextContentSize()&&(!m.canInsertTextAfter()||!b.canInsertTextAfter()&&!m.isComposing()||y)})(t,a)}function Mk(t,e){return Wo(t)&&t.nodeValue!==null&&e!==0&&e!==t.nodeValue.length}function Ak(t,e,n){let{anchorNode:o,anchorOffset:r,focusNode:i,focusOffset:s}=t;wb&&(wb=!1,Mk(o,r)&&Mk(i,s)&&!is)||Yn(e,(()=>{if(!n)return void In(null);if(!Oc(e,o,i))return;let a=Fe();if(is&&de(a)&&a.isCollapsed()){let l=a.anchor,c=is.anchor;(l.key===c.key&&l.offset===c.offset+1||l.offset===1&&c.getNode().is(l.getNode().getPreviousSibling()))&&(a=is.clone(),In(a))}if(is=null,de(a)){let l=a.anchor,c=l.getNode();if(a.isCollapsed()){t.type==="Range"&&t.anchorNode===t.focusNode&&(a.dirty=!0);let d=co(e).event,u=d?d.timeStamp:performance.now(),[p,f,h,m,_]=JN,b=On(),y=e.isComposing()===!1&&b.getTextContent()==="";if(u<_+200&&l.offset===h&&l.key===m)ip(a,p,f);else if(l.type==="text")te(c)||V(141),ZN(a,c);else if(l.type==="element"&&!y){U(c)||V(259);let x=l.getNode();x.isEmpty()?(function(v,E){let C=E.getTextFormat(),k=E.getTextStyle();ip(v,C,k)})(a,x):ip(a,0,"")}}else{let d=l.key,u=a.focus.key,p=a.getNodes(),f=p.length,h=a.isBackward(),m=h?s:r,_=h?r:s,b=h?u:d,y=h?d:u,x=fN,v=!1;for(let E=0;E<f;E++){let C=p[E],k=C.getTextContentSize();if(te(C)&&k!==0&&!(E===0&&C.__key===b&&m===k||E===f-1&&C.__key===y&&_===0)&&(v=!0,x&=C.getFormat(),x===0))break}a.format=v?x:0}}Z(e,Vb,void 0)}))}function ip(t,e,n){t.format===e&&t.style===n||(t.format=e,t.style=n,t.dirty=!0)}function ZN(t,e){ip(t,e.getFormat(),e.getStyle())}function QN(t){if(!t.getTargetRanges)return null;let e=t.getTargetRanges();return e.length===0?null:e[0]}function Qu(t,e){let n=t._compositionKey;if(Vt(null),n!==null&&e!=null){if(e===""){let o=Lt(n),r=ps(t.getElementByKey(n));return void(r!==null&&r.nodeValue!==null&&te(o)&&dy(o,r.nodeValue,null,null,!0))}if(e[e.length-1]===`
|
|
107
|
-
`){let o=Fe();if(de(o)){let r=o.focus;return o.anchor.set(r.key,r.offset,r.type),void Z(t,mp,null)}}}cy(!0,t,e)}function e1(t){let e=t.__lexicalEventHandles;return e===void 0&&(e=[],t.__lexicalEventHandles=e),e}var Ta=new Map;function t1(t){let e=L1(t.target);if(e===null)return;let n=ay(e.anchorNode);if(n===null)return;Tb&&(Tb=!1,Yn(n,(()=>{let l=gs(),c=e.anchorNode;(yn(c)||Wo(c))&&In(Mp(l,e,n,t))})));let o=ly(n),r=o[o.length-1],i=r._key,s=Ta.get(i),a=s||r;a!==n&&Ak(e,a,!1),Ak(e,n,!0),n!==r?Ta.set(i,n):s&&Ta.delete(i)}function Lk(t){t._lexicalHandled=!0}function Rk(t){return t._lexicalHandled===!0}var MK=()=>{};function AK(t){let e=t.ownerDocument,n=_p.get(e);if(n===void 0)return void MK();let o=n-1;o>=0||V(164),_p.set(e,o),o===0&&e.removeEventListener("selectionchange",t1);let r=Ic(t);Ap(r)?((function(s){if(s._parentEditor!==null){let a=ly(s),l=a[a.length-1]._key;Ta.get(l)===s&&Ta.delete(l)}else Ta.delete(s._key)})(r),t.__lexicalEditor=null):r&&V(198);let i=e1(t);for(let s=0;s<i.length;s++)i[s]();t.__lexicalEventHandles=[]}function Sb(t,e,n){jt();let o=t.__key,r=t.getParent();if(r===null)return;let i=(function(a){let l=Fe();if(!de(l)||!U(a))return l;let{anchor:c,focus:d}=l,u=c.getNode(),p=d.getNode();return Tp(u,a)&&c.set(a.__key,0,"element"),Tp(p,a)&&d.set(a.__key,0,"element"),l})(t),s=!1;if(de(i)&&e){let a=i.anchor,l=i.focus;a.key===o&&(xp(a,t,r,t.getPreviousSibling(),t.getNextSibling()),s=!0),l.key===o&&(xp(l,t,r,t.getPreviousSibling(),t.getNextSibling()),s=!0)}else Ip(i)&&e&&t.isSelected()&&t.selectPrevious();if(de(i)&&e&&!s){let a=t.getIndexWithinParent();ai(t),yp(i,r,a,-1)}else ai(t);n||vo(r)||r.canBeEmpty()||!r.isEmpty()||Sb(r,e),e&&i&&Nn(r)&&r.isEmpty()&&r.selectEnd()}function LK(t){return t}var ci=class{static getType(){let{ownNodeType:e}=my(this);return e===void 0&&V(64,this.name),e}static clone(e){V(65,this.name)}$config(){return{}}config(e,n){let o=n.extends||Object.getPrototypeOf(this.constructor);return Object.assign(n,{extends:o,type:e}),{[e]:n}}afterCloneFrom(e){this.__key===e.__key?(this.__parent=e.__parent,this.__next=e.__next,this.__prev=e.__prev,this.__state=e.__state):e.__state&&(this.__state=e.__state.getWritable(this))}constructor(e){this.__type=this.constructor.getType(),this.__parent=null,this.__prev=null,this.__next=null,Object.defineProperty(this,"__state",{configurable:!0,enumerable:!1,value:void 0,writable:!0}),x1(this,e)}getType(){return this.__type}isInline(){V(137,this.constructor.name)}isAttached(){let e=this.__key;for(;e!==null;){if(e==="root")return!0;let n=Lt(e);if(n===null)break;e=n.__parent}return!1}isSelected(e){let n=e||Fe();if(n==null)return!1;let o=n.getNodes().some((r=>r.__key===this.__key));if(te(this))return o;if(de(n)&&n.anchor.type==="element"&&n.focus.type==="element"){if(n.isCollapsed())return!1;let r=this.getParent();if(Ye(this)&&this.isInline()&&r){let i=n.isBackward()?n.focus:n.anchor;if(r.is(i.getNode())&&i.offset===r.getChildrenSize()&&this.is(r.getLastChild()))return!1}}return o}getKey(){return this.__key}getIndexWithinParent(){let e=this.getParent();if(e===null)return-1;let n=e.getFirstChild(),o=0;for(;n!==null;){if(this.is(n))return o;o++,n=n.getNextSibling()}return-1}getParent(){let e=this.getLatest().__parent;return e===null?null:Lt(e)}getParentOrThrow(){let e=this.getParent();return e===null&&V(66,this.__key),e}getTopLevelElement(){let e=this;for(;e!==null;){let n=e.getParent();if(vo(n))return U(e)||e===this&&Ye(e)||V(194),e;e=n}return null}getTopLevelElementOrThrow(){let e=this.getTopLevelElement();return e===null&&V(67,this.__key),e}getParents(){let e=[],n=this.getParent();for(;n!==null;)e.push(n),n=n.getParent();return e}getParentKeys(){let e=[],n=this.getParent();for(;n!==null;)e.push(n.__key),n=n.getParent();return e}getPreviousSibling(){let e=this.getLatest().__prev;return e===null?null:Lt(e)}getPreviousSiblings(){let e=[],n=this.getParent();if(n===null)return e;let o=n.getFirstChild();for(;o!==null&&!o.is(this);)e.push(o),o=o.getNextSibling();return e}getNextSibling(){let e=this.getLatest().__next;return e===null?null:Lt(e)}getNextSiblings(){let e=[],n=this.getNextSibling();for(;n!==null;)e.push(n),n=n.getNextSibling();return e}getCommonAncestor(e){let n=U(this)?this:this.getParent(),o=U(e)?e:e.getParent(),r=n&&o?_c(n,o):null;return r?r.commonAncestor:null}is(e){return e!=null&&this.__key===e.__key}isBefore(e){let n=_c(this,e);return n!==null&&(n.type==="descendant"||(n.type==="branch"?vy(n)===-1:(n.type!=="same"&&n.type!=="ancestor"&&V(279),!1)))}isParentOf(e){let n=_c(this,e);return n!==null&&n.type==="ancestor"}getNodesBetween(e){let n=this.isBefore(e),o=[],r=new Set,i=this;for(;i!==null;){let s=i.__key;if(r.has(s)||(r.add(s),o.push(i)),i===e)break;let a=U(i)?n?i.getFirstChild():i.getLastChild():null;if(a!==null){i=a;continue}let l=n?i.getNextSibling():i.getPreviousSibling();if(l!==null){i=l;continue}let c=i.getParentOrThrow();if(r.has(c.__key)||o.push(c),c===e)break;let d=null,u=c;do{if(u===null&&V(68),d=n?u.getNextSibling():u.getPreviousSibling(),u=u.getParent(),u===null)break;d!==null||r.has(u.__key)||o.push(u)}while(d===null);i=d}return n||o.reverse(),o}isDirty(){let e=nt()._dirtyLeaves;return e!==null&&e.has(this.__key)}getLatest(){let e=Lt(this.__key);return e===null&&V(113),e}getWritable(){jt();let e=Mr(),n=nt(),o=e._nodeMap,r=this.__key,i=this.getLatest(),s=n._cloneNotNeeded,a=Fe();if(a!==null&&a.setCachedNodes(null),s.has(r))return wp(i),i;let l=F1(i);return s.add(r),wp(l),o.set(r,l),l}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(e,n){V(70)}updateDOM(e,n,o){V(71)}exportDOM(e){return{element:this.createDOM(e._config,e)}}exportJSON(){let e=this.__state?this.__state.toJSON():void 0;return{type:this.__type,version:1,...e}}static importJSON(e){V(18,this.name)}updateFromJSON(e){return(function(n,o){let r=n.getWritable(),i=o.$,s=i;for(let a of vN(r).flatKeys)a in o&&(s!==void 0&&s!==i||(s={...i}),s[a]=o[a]);return(r.__state||s)&&jb(n).updateFromJSON(s),r})(this,e)}static transform(){return null}remove(e){Sb(this,!0,e)}replace(e,n){jt();let o=Fe();o!==null&&(o=o.clone()),sb(this,e);let r=this.getLatest(),i=this.__key,s=e.__key,a=e.getWritable(),l=this.getParentOrThrow().getWritable(),c=l.__size;ai(a);let d=r.getPreviousSibling(),u=r.getNextSibling(),p=r.__prev,f=r.__next,h=r.__parent;if(Sb(r,!1,!0),d===null?l.__first=s:d.getWritable().__next=s,a.__prev=p,u===null?l.__last=s:u.getWritable().__prev=s,a.__next=f,a.__parent=h,l.__size=c,n&&(U(this)&&U(a)||V(139),this.getChildren().forEach((m=>{a.append(m)}))),de(o)){In(o);let m=o.anchor,_=o.focus;m.key===i&&$k(m,a),_.key===i&&$k(_,a)}return ii()===i&&Vt(s),a}insertAfter(e,n=!0){jt(),sb(this,e);let o=this.getWritable(),r=e.getWritable(),i=r.getParent(),s=Fe(),a=!1,l=!1;if(i!==null){let f=e.getIndexWithinParent();if(ai(r),de(s)){let h=i.__key,m=s.anchor,_=s.focus;a=m.type==="element"&&m.key===h&&m.offset===f+1,l=_.type==="element"&&_.key===h&&_.offset===f+1}}let c=this.getNextSibling(),d=this.getParentOrThrow().getWritable(),u=r.__key,p=o.__next;if(c===null?d.__last=u:c.getWritable().__prev=u,d.__size++,o.__next=u,r.__next=p,r.__prev=o.__key,r.__parent=o.__parent,n&&de(s)){let f=this.getIndexWithinParent();yp(s,d,f+1);let h=d.__key;a&&s.anchor.set(h,f+2,"element"),l&&s.focus.set(h,f+2,"element")}return e}insertBefore(e,n=!0){jt(),sb(this,e);let o=this.getWritable(),r=e.getWritable(),i=r.__key;ai(r);let s=this.getPreviousSibling(),a=this.getParentOrThrow().getWritable(),l=o.__prev,c=this.getIndexWithinParent();s===null?a.__first=i:s.getWritable().__next=i,a.__size++,o.__prev=i,r.__prev=l,r.__next=o.__key,r.__parent=o.__parent;let d=Fe();return n&&de(d)&&yp(d,this.getParentOrThrow(),c),e}isParentRequired(){return!1}createParentElementNode(){return Nr()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(e,n){jt();let o=this.getPreviousSibling(),r=this.getParentOrThrow();if(o===null)return r.select(0,0);if(U(o))return o.select();if(!te(o)){let i=o.getIndexWithinParent()+1;return r.select(i,i)}return o.select(e,n)}selectNext(e,n){jt();let o=this.getNextSibling(),r=this.getParentOrThrow();if(o===null)return r.select();if(U(o))return o.select(0,0);if(!te(o)){let i=o.getIndexWithinParent();return r.select(i,i)}return o.select(e,n)}markDirty(){this.getWritable()}reconcileObservedMutation(e,n){this.markDirty()}},Da=class t extends ci{static getType(){return"linebreak"}static clone(e){return new t(e.__key)}constructor(e){super(e)}getTextContent(){return`
|
|
108
|
-
`}createDOM(){return document.createElement("br")}updateDOM(){return!1}isInline(){return!0}static importDOM(){return{br:e=>(function(n){let o=n.parentElement;if(o!==null&&Mb(o)){let r=o.firstChild;if(r===n||r.nextSibling===n&&ep(r)){let i=o.lastChild;if(i===n||i.previousSibling===n&&ep(i))return!0}}return!1})(e)||(function(n){let o=n.parentElement;if(o!==null&&Mb(o)){let r=o.firstChild;if(r===n||r.nextSibling===n&&ep(r))return!1;let i=o.lastChild;if(i===n||i.previousSibling===n&&ep(i))return!0}return!1})(e)?null:{conversion:RK,priority:0}}}static importJSON(e){return Oa().updateFromJSON(e)}};function RK(t){return{node:Oa()}}function Oa(){return Ac(new Da)}function ss(t){return t instanceof Da}function ep(t){return Wo(t)&&/^( |\t|\r?\n)+$/.test(t.textContent||"")}function tb(t,e){return 16&e?"code":e&kp?"mark":32&e?"sub":64&e?"sup":null}function nb(t,e){return 1&e?"strong":2&e?"em":"span"}function n1(t,e,n,o,r){let i=o.classList,s=Sa(r,"base");s!==void 0&&i.add(...s),s=Sa(r,"underlineStrikethrough");let a=!1,l=e&vc&&e&xc;s!==void 0&&(n&vc&&n&xc?(a=!0,l||i.add(...s)):l&&i.remove(...s));for(let c in ln){let d=ln[c];if(s=Sa(r,c),s!==void 0)if(n&d){if(a&&(c==="underline"||c==="strikethrough")){e&d&&i.remove(...s);continue}e&d&&(!l||c!=="underline")&&c!=="strikethrough"||i.add(...s)}else e&d&&i.remove(...s)}}function o1(t,e,n){let o=e.firstChild,r=n.isComposing(),i=t+(r?Np:"");if(o==null)e.textContent=i;else{let s=o.nodeValue;if(s!==i)if(r||as){let[a,l,c]=(function(d,u){let p=d.length,f=u.length,h=0,m=0;for(;h<p&&h<f&&d[h]===u[h];)h++;for(;m+h<p&&m+h<f&&d[p-m-1]===u[f-m-1];)m++;return[h,p-h-m,u.slice(h,f-m)]})(s,i);l!==0&&o.deleteData(a,l),o.insertData(a,c)}else o.nodeValue=i}}function Pk(t,e,n,o,r,i){o1(r,t,e);let s=i.theme.text;s!==void 0&&n1(0,0,o,t,s)}function tp(t,e){let n=document.createElement(e);return n.appendChild(t),n}var ds=class t extends ci{static getType(){return"text"}static clone(e){return new t(e.__text,e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__text=e.__text,this.__format=e.__format,this.__style=e.__style,this.__mode=e.__mode,this.__detail=e.__detail}constructor(e="",n){super(n),this.__text=e,this.__format=0,this.__style="",this.__mode=0,this.__detail=0}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){let e=this.getLatest();return cK[e.__mode]}getStyle(){return this.getLatest().__style}isToken(){return this.getLatest().__mode===1}isComposing(){return this.__key===ii()}isSegmented(){return this.getLatest().__mode===2}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(e){let n=ln[e];return!!(this.getFormat()&n)}isSimpleText(){return this.__type==="text"&&this.__mode===0}getTextContent(){return this.getLatest().__text}getFormatFlags(e,n){return Ep(this.getLatest().__format,e,n)}canHaveFormat(){return!0}isInline(){return!0}createDOM(e,n){let o=this.__format,r=tb(0,o),i=nb(0,o),s=r===null?i:r,a=document.createElement(s),l=a;this.hasFormat("code")&&a.setAttribute("spellcheck","false"),r!==null&&(l=document.createElement(i),a.appendChild(l)),Pk(l,this,0,o,this.__text,e);let c=this.__style;return c!==""&&(a.style.cssText=c),a}updateDOM(e,n,o){let r=this.__text,i=e.__format,s=this.__format,a=tb(0,i),l=tb(0,s),c=nb(0,i),d=nb(0,s);if((a===null?c:a)!==(l===null?d:l))return!0;if(a===l&&c!==d){let m=n.firstChild;m==null&&V(48);let _=document.createElement(d);return Pk(_,this,0,s,r,o),n.replaceChild(_,m),!1}let u=n;l!==null&&a!==null&&(u=n.firstChild,u==null&&V(49)),o1(r,u,this);let p=o.theme.text;p!==void 0&&i!==s&&n1(0,i,s,u,p);let f=e.__style,h=this.__style;return f!==h&&(n.style.cssText=h),!1}static importDOM(){return{"#text":()=>({conversion:$K,priority:0}),b:()=>({conversion:FK,priority:0}),code:()=>({conversion:Cr,priority:0}),em:()=>({conversion:Cr,priority:0}),i:()=>({conversion:Cr,priority:0}),mark:()=>({conversion:Cr,priority:0}),s:()=>({conversion:Cr,priority:0}),span:()=>({conversion:PK,priority:0}),strong:()=>({conversion:Cr,priority:0}),sub:()=>({conversion:Cr,priority:0}),sup:()=>({conversion:Cr,priority:0}),u:()=>({conversion:Cr,priority:0})}}static importJSON(e){return Ut().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setTextContent(e.text).setFormat(e.format).setDetail(e.detail).setMode(e.mode).setStyle(e.style)}exportDOM(e){let{element:n}=super.exportDOM(e);return yn(n)||V(132),n.style.whiteSpace="pre-wrap",this.hasFormat("lowercase")?n.style.textTransform="lowercase":this.hasFormat("uppercase")?n.style.textTransform="uppercase":this.hasFormat("capitalize")&&(n.style.textTransform="capitalize"),this.hasFormat("bold")&&(n=tp(n,"b")),this.hasFormat("italic")&&(n=tp(n,"i")),this.hasFormat("strikethrough")&&(n=tp(n,"s")),this.hasFormat("underline")&&(n=tp(n,"u")),{element:n}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),...super.exportJSON()}}selectionTransform(e,n){}setFormat(e){let n=this.getWritable();return n.__format=typeof e=="string"?ln[e]:e,n}setDetail(e){let n=this.getWritable();return n.__detail=typeof e=="string"?sK[e]:e,n}setStyle(e){let n=this.getWritable();return n.__style=e,n}toggleFormat(e){let n=Ep(this.getFormat(),e,null);return this.setFormat(n)}toggleDirectionless(){let e=this.getWritable();return e.__detail^=1,e}toggleUnmergeable(){let e=this.getWritable();return e.__detail^=2,e}setMode(e){let n=lK[e];if(this.__mode===n)return this;let o=this.getWritable();return o.__mode=n,o}setTextContent(e){if(this.__text===e)return this;let n=this.getWritable();return n.__text=e,n}select(e,n){jt();let o=e,r=n,i=Fe(),s=this.getTextContent(),a=this.__key;if(typeof s=="string"){let l=s.length;o===void 0&&(o=l),r===void 0&&(r=l)}else o=0,r=0;if(!de(i))return s1(a,o,a,r,"text","text");{let l=ii();l!==i.anchor.key&&l!==i.focus.key||Vt(a),i.setTextNodeRange(this,o,this,r)}return i}selectStart(){return this.select(0,0)}selectEnd(){let e=this.getTextContentSize();return this.select(e,e)}spliceText(e,n,o,r){let i=this.getWritable(),s=i.__text,a=o.length,l=e;l<0&&(l=a+l,l<0&&(l=0));let c=Fe();if(r&&de(c)){let u=e+a;c.setTextNodeRange(i,u,i,u)}let d=s.slice(0,l)+o+s.slice(l+n);return i.__text=d,i}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...e){jt();let n=this.getLatest(),o=n.getTextContent();if(o==="")return[];let r=n.__key,i=ii(),s=o.length;e.sort(((T,w)=>T-w)),e.push(s);let a=[],l=e.length;for(let T=0,w=0;T<s&&w<=l;w++){let S=e[w];S>T&&(a.push(o.slice(T,S)),T=S)}let c=a.length;if(c===1)return[n];let d=a[0],u=n.getParent(),p,f=n.getFormat(),h=n.getStyle(),m=n.__detail,_=!1,b=null,y=null,x=Fe();if(de(x)){let[T,w]=x.isBackward()?[x.focus,x.anchor]:[x.anchor,x.focus];T.type==="text"&&T.key===r&&(b=T),w.type==="text"&&w.key===r&&(y=w)}n.isSegmented()?(p=Ut(d),p.__format=f,p.__style=h,p.__detail=m,p.__state=Sk(n,p),_=!0):p=n.setTextContent(d);let v=[p];for(let T=1;T<c;T++){let w=Ut(a[T]);w.__format=f,w.__style=h,w.__detail=m,w.__state=Sk(n,w);let S=w.__key;i===r&&Vt(S),v.push(w)}let E=b?b.offset:null,C=y?y.offset:null,k=0;for(let T of v){if(!b&&!y)break;let w=k+T.getTextContentSize();if(b!==null&&E!==null&&E<=w&&E>=k&&(b.set(T.getKey(),E-k,"text"),E<w&&(b=null)),y!==null&&C!==null&&C<=w&&C>=k){y.set(T.getKey(),C-k,"text");break}k=w}if(u!==null){(function(S){let N=S.getPreviousSibling(),D=S.getNextSibling();N!==null&&wp(N),D!==null&&wp(D)})(this);let T=u.getWritable(),w=this.getIndexWithinParent();_?(T.splice(w,0,v),this.remove()):T.splice(w,1,v),de(x)&&yp(x,u,w,c-1)}return v}mergeWithSibling(e){let n=e===this.getPreviousSibling();n||e===this.getNextSibling()||V(50);let o=this.__key,r=e.__key,i=this.__text,s=i.length;ii()===r&&Vt(o);let a=Fe();if(de(a)){let u=a.anchor,p=a.focus;u!==null&&u.key===r&&Wk(u,n,o,e,s),p!==null&&p.key===r&&Wk(p,n,o,e,s)}let l=e.__text,c=n?l+i:i+l;this.setTextContent(c);let d=this.getWritable();return e.remove(),d}isTextEntity(){return!1}};function PK(t){return{forChild:Xb(t.style),node:null}}function FK(t){let e=t,n=e.style.fontWeight==="normal";return{forChild:Xb(e.style,n?void 0:"bold"),node:null}}var Fk=new WeakMap;function BK(t){if(!yn(t))return!1;if(t.nodeName==="PRE")return!0;let e=t.style.whiteSpace;return typeof e=="string"&&e.startsWith("pre")}function $K(t){let e=t;t.parentElement===null&&V(129);let n=e.textContent||"";if((function(o){let r,i=o.parentNode,s=[o];for(;i!==null&&(r=Fk.get(i))===void 0&&!BK(i);)s.push(i),i=i.parentNode;let a=r===void 0?i:r;for(let l=0;l<s.length;l++)Fk.set(s[l],a);return a})(e)!==null){let o=n.split(/(\r?\n|\t)/),r=[],i=o.length;for(let s=0;s<i;s++){let a=o[s];a===`
|
|
109
|
-
`||a===`\r
|
|
110
|
-
`?r.push(Oa()):a===" "?r.push(Op()):a!==""&&r.push(Ut(a))}return{node:r}}if(n=n.replace(/\r/g,"").replace(/[ \t\n]+/g," "),n==="")return{node:null};if(n[0]===" "){let o=e,r=!0;for(;o!==null&&(o=Bk(o,!1))!==null;){let i=o.textContent||"";if(i.length>0){/[ \t\n]$/.test(i)&&(n=n.slice(1)),r=!1;break}}r&&(n=n.slice(1))}if(n[n.length-1]===" "){let o=e,r=!0;for(;o!==null&&(o=Bk(o,!0))!==null;)if((o.textContent||"").replace(/^( |\t|\r?\n)+/,"").length>0){r=!1;break}r&&(n=n.slice(0,n.length-1))}return n===""?{node:null}:{node:Ut(n)}}function Bk(t,e){let n=t;for(;;){let o;for(;(o=e?n.nextSibling:n.previousSibling)===null;){let i=n.parentElement;if(i===null)return null;n=i}if(n=o,yn(n)){let i=n.style.display;if(i===""&&!P1(n)||i!==""&&!i.startsWith("inline"))return null}let r=n;for(;(r=e?n.firstChild:n.lastChild)!==null;)n=r;if(Wo(n))return n;if(n.nodeName==="BR")return null}}var zK={code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function Cr(t){let e=zK[t.nodeName.toLowerCase()];return e===void 0?{node:null}:{forChild:Xb(t.style,e),node:null}}function Ut(t=""){return Ac(new ds(t))}function te(t){return t instanceof ds}function Xb(t,e){let n=t.fontWeight,o=t.textDecoration.split(" "),r=n==="700"||n==="bold",i=o.includes("line-through"),s=t.fontStyle==="italic",a=o.includes("underline"),l=t.verticalAlign;return c=>(te(c)&&(r&&!c.hasFormat("bold")&&c.toggleFormat("bold"),i&&!c.hasFormat("strikethrough")&&c.toggleFormat("strikethrough"),s&&!c.hasFormat("italic")&&c.toggleFormat("italic"),a&&!c.hasFormat("underline")&&c.toggleFormat("underline"),l!=="sub"||c.hasFormat("subscript")||c.toggleFormat("subscript"),l!=="super"||c.hasFormat("superscript")||c.toggleFormat("superscript"),e&&!c.hasFormat(e)&&c.toggleFormat(e)),c)}var Ia=class t extends ds{static getType(){return"tab"}static clone(e){return new t(e.__key)}constructor(e){super(" ",e),this.__detail=2}static importDOM(){return null}createDOM(e){let n=super.createDOM(e),o=Sa(e.theme,"tab");return o!==void 0&&n.classList.add(...o),n}static importJSON(e){return Op().updateFromJSON(e)}setTextContent(e){return e!==" "&&e!==""&&V(126),super.setTextContent(" ")}spliceText(e,n,o,r){return o===""&&n===0||o===" "&&n===1||V(286),this}setDetail(e){return e!==2&&V(127),this}setMode(e){return e!=="normal"&&V(128),this}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}};function Op(){return Ac(new Ia)}function Zb(t){return t instanceof Ia}var kb=class{constructor(e,n,o){this._selection=null,this.key=e,this.offset=n,this.type=o}is(e){return this.key===e.key&&this.offset===e.offset&&this.type===e.type}isBefore(e){return this.key===e.key?this.offset<e.offset:xy(_o(fi(this,"next")),_o(fi(e,"next")))<0}getNode(){let e=Lt(this.key);return e===null&&V(20),e}set(e,n,o,r){let i=this._selection,s=this.key;r&&this.key===e&&this.offset===n&&this.type===o||(this.key=e,this.offset=n,this.type=o,Ha()||(ii()===s&&Vt(e),i!==null&&(i.setCachedNodes(null),i.dirty=!0)))}};function xo(t,e,n){return new kb(t,e,n)}function ob(t,e){let n=e.__key,o=t.offset,r="element";if(te(e)){r="text";let i=e.getTextContentSize();o>i&&(o=i)}else if(!U(e)){let i=e.getNextSibling();if(te(i))n=i.__key,o=0,r="text";else{let s=e.getParent();s&&(n=s.__key,o=e.getIndexWithinParent()+1)}}t.set(n,o,r)}function $k(t,e){if(U(e)){let n=e.getLastDescendant();U(n)||te(n)?ob(t,n):ob(t,e)}else ob(t,e)}var bp=class t{constructor(e){this._cachedNodes=null,this._nodes=e,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){if(!Ip(e))return!1;let n=this._nodes,o=e._nodes;return n.size===o.size&&Array.from(n).every((r=>o.has(r)))}isCollapsed(){return!1}isBackward(){return!1}getStartEndPoints(){return null}add(e){this.dirty=!0,this._nodes.add(e),this._cachedNodes=null}delete(e){this.dirty=!0,this._nodes.delete(e),this._cachedNodes=null}clear(){this.dirty=!0,this._nodes.clear(),this._cachedNodes=null}has(e){return this._nodes.has(e)}clone(){return new t(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(e){}insertText(){}insertNodes(e){let n=this.getNodes(),o=n.length,r=n[o-1],i;if(te(r))i=r.select();else{let s=r.getIndexWithinParent()+1;i=r.getParentOrThrow().select(s,s)}i.insertNodes(e);for(let s=0;s<o;s++)n[s].remove()}getNodes(){let e=this._cachedNodes;if(e!==null)return e;let n=this._nodes,o=[];for(let r of n){let i=Lt(r);i!==null&&o.push(i)}return Ha()||(this._cachedNodes=o),o}getTextContent(){let e=this.getNodes(),n="";for(let o=0;o<e.length;o++)n+=e[o].getTextContent();return n}deleteNodes(){let e=this.getNodes();if((Fe()||gs())===this&&e[0]){let n=Yt(e[0],"next");K1(pi(n,n))}for(let n of e)n.remove()}};function de(t){return t instanceof us}var us=class t{constructor(e,n,o,r){this.anchor=e,this.focus=n,e._selection=this,n._selection=this,this._cachedNodes=null,this.format=o,this.style=r,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){return!!de(e)&&this.anchor.is(e.anchor)&&this.focus.is(e.focus)&&this.format===e.format&&this.style===e.style}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){let e=this._cachedNodes;if(e!==null)return e;let n=(function(o){let r=[],[i,s]=o.getTextSlices();i&&r.push(i.caret.origin);let a=new Set,l=new Set;for(let c of o)if(yo(c)){let{origin:d}=c;r.length===0?a.add(d):(l.add(d),r.push(d))}else{let{origin:d}=c;U(d)&&l.has(d)||r.push(d)}if(s&&r.push(s.caret.origin),fs(o.focus)&&U(o.focus.origin)&&o.focus.getNodeAtCaret()===null)for(let c=Ir(o.focus.origin,"previous");yo(c)&&a.has(c.origin)&&!c.origin.isEmpty()&&c.origin.is(r[r.length-1]);c=$a(c))a.delete(c.origin),r.pop();for(;r.length>1;){let c=r[r.length-1];if(!U(c)||l.has(c)||c.isEmpty()||a.has(c))break;r.pop()}if(r.length===0&&o.isCollapsed()){let c=_o(o.anchor),d=_o(o.anchor.getFlipped()),u=f=>Dr(f)?f.origin:f.getNodeAtCaret(),p=u(c)||u(d)||(o.anchor.getNodeAtCaret()?c.origin:d.origin);r.push(p)}return r})(Cy(Pb(this),"next"));return Ha()||(this._cachedNodes=n),n}setTextNodeRange(e,n,o,r){this.anchor.set(e.__key,n,"text"),this.focus.set(o.__key,r,"text")}getTextContent(){let e=this.getNodes();if(e.length===0)return"";let n=e[0],o=e[e.length-1],r=this.anchor,i=this.focus,s=r.isBefore(i),[a,l]=Nb(this),c="",d=!0;for(let u=0;u<e.length;u++){let p=e[u];if(U(p)&&!p.isInline())d||(c+=`
|
|
111
|
-
`),d=!p.isEmpty();else if(d=!1,te(p)){let f=p.getTextContent();p===n?p===o?r.type==="element"&&i.type==="element"&&i.offset!==r.offset||(f=a<l?f.slice(a,l):f.slice(l,a)):f=s?f.slice(a):f.slice(l):p===o&&(f=s?f.slice(0,l):f.slice(0,a)),c+=f}else!Ye(p)&&!ss(p)||p===o&&this.isCollapsed()||(c+=p.getTextContent())}return c}applyDOMRange(e){let n=nt(),o=n.getEditorState()._selection,r=i1(e.startContainer,e.startOffset,e.endContainer,e.endOffset,n,o);if(r===null)return;let[i,s]=r;this.anchor.set(i.key,i.offset,i.type,!0),this.focus.set(s.key,s.offset,s.type,!0),pp(this)}clone(){let e=this.anchor,n=this.focus;return new t(xo(e.key,e.offset,e.type),xo(n.key,n.offset,n.type),this.format,this.style)}toggleFormat(e){this.format=Ep(this.format,e,null),this.dirty=!0}setFormat(e){this.format=e,this.dirty=!0}setStyle(e){this.style=e,this.dirty=!0}hasFormat(e){let n=ln[e];return!!(this.format&n)}insertRawText(e){let n=e.split(/(\r?\n|\t)/),o=[],r=n.length;for(let i=0;i<r;i++){let s=n[i];s===`
|
|
112
|
-
`||s===`\r
|
|
113
|
-
`?o.push(Oa()):s===" "?o.push(Op()):o.push(Ut(s))}this.insertNodes(o)}insertText(e){let n=this.anchor,o=this.focus,r=this.format,i=this.style,s=n,a=o;!this.isCollapsed()&&o.isBefore(n)&&(s=o,a=n),s.type==="element"&&(function(_,b,y,x){let v=_.getNode(),E=v.getChildAtIndex(_.offset),C=Ut(),k=Nn(v)?Nr().append(C):C;C.setFormat(y),C.setStyle(x),E===null?v.append(k):E.insertBefore(k),_.is(b)&&b.set(C.__key,0,"text"),_.set(C.__key,0,"text")})(s,a,r,i),a.type==="element"&&za(a,_o(fi(a,"next")));let l=s.offset,c=a.offset,d=this.getNodes(),u=d.length,p=d[0];te(p)||V(26);let f=p.getTextContent().length,h=p.getParentOrThrow(),m=d[u-1];if(u===1&&a.type==="element"&&(c=f,a.set(s.key,c,"text")),this.isCollapsed()&&l===f&&(wr(p)||!p.canInsertTextAfter()||!h.canInsertTextAfter()&&p.getNextSibling()===null)){let _=p.getNextSibling();if(te(_)&&_.canInsertTextBefore()&&!wr(_)||(_=Ut(),_.setFormat(r),_.setStyle(i),h.canInsertTextAfter()?p.insertAfter(_):h.insertAfter(_)),_.select(0,0),p=_,e!=="")return void this.insertText(e)}else if(this.isCollapsed()&&l===0&&(wr(p)||!p.canInsertTextBefore()||!h.canInsertTextBefore()&&p.getPreviousSibling()===null)){let _=p.getPreviousSibling();if(te(_)&&!wr(_)||(_=Ut(),_.setFormat(r),h.canInsertTextBefore()?p.insertBefore(_):h.insertBefore(_)),_.select(),p=_,e!=="")return void this.insertText(e)}else if(p.isSegmented()&&l!==f){let _=Ut(p.getTextContent());_.setFormat(r),p.replace(_),p=_}else if(!this.isCollapsed()&&e!==""){let _=m.getParent();if(!h.canInsertTextBefore()||!h.canInsertTextAfter()||U(_)&&(!_.canInsertTextBefore()||!_.canInsertTextAfter()))return this.insertText(""),r1(this.anchor,this.focus,null),void this.insertText(e)}if(u===1){if(si(p)){let x=Ut(e);return x.select(),void p.replace(x)}let _=p.getFormat(),b=p.getStyle();if(l!==c||_===r&&b===i){if(Zb(p)){let x=Ut(e);return x.setFormat(r),x.setStyle(i),x.select(),void p.replace(x)}}else{if(p.getTextContent()!==""){let x=Ut(e);if(x.setFormat(r),x.setStyle(i),x.select(),l===0)p.insertBefore(x,!1);else{let[v]=p.splitText(l);v.insertAfter(x,!1)}return void(x.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=e.length))}p.setFormat(r),p.setStyle(i)}let y=c-l;p=p.spliceText(l,y,e,!0),p.getTextContent()===""?p.remove():this.anchor.type==="text"&&(p.isComposing()?this.anchor.offset-=e.length:(this.format=_,this.style=b))}else{let _=new Set([...p.getParentKeys(),...m.getParentKeys()]),b=U(p)?p:p.getParentOrThrow(),y=U(m)?m:m.getParentOrThrow(),x=m;if(!b.is(y)&&y.isInline())do x=y,y=y.getParentOrThrow();while(y.isInline());if(a.type==="text"&&(c!==0||m.getTextContent()==="")||a.type==="element"&&m.getIndexWithinParent()<c)if(te(m)&&!si(m)&&c!==m.getTextContentSize()){if(m.isSegmented()){let T=Ut(m.getTextContent());m.replace(T),m=T}Nn(a.getNode())||a.type!=="text"||(m=m.spliceText(0,c,"")),_.add(m.__key)}else{let T=m.getParentOrThrow();T.canBeEmpty()||T.getChildrenSize()!==1?m.remove():T.remove()}else _.add(m.__key);let v=y.getChildren(),E=new Set(d),C=b.is(y),k=b.isInline()&&p.getNextSibling()===null?b:p;for(let T=v.length-1;T>=0;T--){let w=v[T];if(w.is(p)||U(w)&&w.isParentOf(p))break;w.isAttached()&&(!E.has(w)||w.is(x)?C||k.insertAfter(w,!1):w.remove())}if(!C){let T=y,w=null;for(;T!==null;){let S=T.getChildren(),N=S.length;(N===0||S[N-1].is(w))&&(_.delete(T.__key),w=T),T=T.getParent()}}if(si(p))if(l===f)p.select();else{let T=Ut(e);T.select(),p.replace(T)}else p=p.spliceText(l,f-l,e,!0),p.getTextContent()===""?p.remove():p.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=e.length);for(let T=1;T<u;T++){let w=d[T],S=w.__key;_.has(S)||w.remove()}}}removeText(){let e=Fe()===this;bc(this,U1(Pb(this))),e&&Fe()!==this&&In(this)}formatText(e,n=null){if(this.isCollapsed())return this.toggleFormat(e),void Vt(null);let o=this.getNodes(),r=[];for(let v of o)te(v)&&r.push(v);let i=v=>{o.forEach((E=>{if(U(E)){let C=E.getFormatFlags(e,v);E.setTextFormat(C)}}))},s=r.length;if(s===0)return this.toggleFormat(e),Vt(null),void i(n);let a=this.anchor,l=this.focus,c=this.isBackward(),d=c?l:a,u=c?a:l,p=0,f=r[0],h=d.type==="element"?0:d.offset;if(d.type==="text"&&h===f.getTextContentSize()&&(p=1,f=r[1],h=0),f==null)return;let m=f.getFormatFlags(e,n);i(m);let _=s-1,b=r[_],y=u.type==="text"?u.offset:b.getTextContentSize();if(f.is(b)){if(h===y)return;if(wr(f)||h===0&&y===f.getTextContentSize())f.setFormat(m);else{let v=f.splitText(h,y),E=h===0?v[0]:v[1];E.setFormat(m),d.type==="text"&&d.set(E.__key,0,"text"),u.type==="text"&&u.set(E.__key,y-h,"text")}return void(this.format=m)}h===0||wr(f)||([,f]=f.splitText(h),h=0),f.setFormat(m);let x=b.getFormatFlags(e,m);y>0&&(y===b.getTextContentSize()||wr(b)||([b]=b.splitText(y)),b.setFormat(x));for(let v=p+1;v<_;v++){let E=r[v],C=E.getFormatFlags(e,x);E.setFormat(C)}d.type==="text"&&d.set(f.__key,h,"text"),u.type==="text"&&u.set(b.__key,y,"text"),this.format=m|x}insertNodes(e){if(e.length===0)return;if(this.isCollapsed()||this.removeText(),this.anchor.key==="root"){this.insertParagraph();let h=Fe();return de(h)||V(134),h.insertNodes(e)}let n=(this.isBackward()?this.focus:this.anchor).getNode(),o=lb(n,kr),r=e[e.length-1];if(U(o)&&"__language"in o){if("__language"in e[0])this.insertText(e[0].getTextContent());else{let h=rb(this);o.splice(h,0,e),r.selectEnd()}return}if(!e.some((h=>(U(h)||Ye(h))&&!h.isInline()))){U(o)||V(211,n.constructor.name,n.getType());let h=rb(this);return o.splice(h,0,e),void r.selectEnd()}let i=(function(h){let m=Nr(),_=null;for(let b=0;b<h.length;b++){let y=h[b],x=ss(y);if(x||Ye(y)&&y.isInline()||U(y)&&y.isInline()||te(y)||y.isParentRequired()){if(_===null&&(_=y.createParentElementNode(),m.append(_),x))continue;_!==null&&_.append(y)}else m.append(y),_=null}return m})(e),s=i.getLastDescendant(),a=i.getChildren(),l=!U(o)||!o.isEmpty()?this.insertParagraph():null,c=a[a.length-1],d=a[0];var u;U(u=d)&&kr(u)&&!u.isEmpty()&&U(o)&&(!o.isEmpty()||o.canMergeWhenEmpty())&&(U(o)||V(211,n.constructor.name,n.getType()),o.append(...d.getChildren()),d=a[1]),d&&(o===null&&V(212,n.constructor.name,n.getType()),(function(h,m,_){let b=m.getParentOrThrow().getLastChild(),y=m,x=[m];for(;y!==b;)y.getNextSibling()||V(140),y=y.getNextSibling(),x.push(y);let v=h;for(let E of x)v=v.insertAfter(E)})(o,d));let p=lb(s,kr);l&&U(p)&&(l.canMergeWhenEmpty()||kr(c))&&(p.append(...l.getChildren()),l.remove()),U(o)&&o.isEmpty()&&o.remove(),s.selectEnd();let f=U(o)?o.getLastChild():null;ss(f)&&p!==o&&f.remove()}insertParagraph(){if(this.anchor.key==="root"){let s=Nr();return On().splice(this.anchor.offset,0,[s]),s.select(),s}let e=rb(this),n=lb(this.anchor.getNode(),kr);U(n)||V(213);let o=n.getChildAtIndex(e),r=o?[o,...o.getNextSiblings()]:[],i=n.insertNewAfter(this,!1);return i?(i.append(...r),i.selectStart(),i):null}insertLineBreak(e){let n=Oa();if(this.insertNodes([n]),e){let o=n.getParentOrThrow(),r=n.getIndexWithinParent();o.select(r,r)}}extract(){let e=this.getNodes(),n=e.length,o=n-1,r=this.anchor,i=this.focus,s=e[0],a=e[o],[l,c]=Nb(this);if(n===0)return[];if(n===1){if(te(s)&&!this.isCollapsed()){let u=l>c?c:l,p=l>c?l:c,f=s.splitText(u,p),h=u===0?f[0]:f[1];return h!=null?[h]:[]}return[s]}let d=r.isBefore(i);if(te(s)){let u=d?l:c;u===s.getTextContentSize()?e.shift():u!==0&&([,s]=s.splitText(u),e[0]=s)}if(te(a)){let u=a.getTextContent().length,p=d?c:l;p===0?e.pop():p!==u&&([a]=a.splitText(p),e[o]=a)}return e}modify(e,n,o){if(Gk(this,e,n,o))return;let r=e==="move",i=nt(),s=Vo(co(i));if(!s)return;let a=i._blockCursorElement,l=i._rootElement,c=this.focus.getNode();if(l===null||a===null||!U(c)||c.isInline()||c.canBeEmpty()||Ib(a,i,l),this.dirty){let d=Ra(i,this.anchor.key),u=Ra(i,this.focus.key);this.anchor.type==="text"&&(d=ps(d)),this.focus.type==="text"&&(u=ps(u)),d&&u&&l1(s,d,this.anchor.offset,u,this.focus.offset)}if((function(d,u,p,f){d.modify(u,p,f)})(s,e,n?"backward":"forward",o),s.rangeCount>0){let d=s.getRangeAt(0),u=this.anchor.getNode(),p=Nn(u)?u:M1(u);if(this.applyDOMRange(d),this.dirty=!0,!r){let f=this.getNodes(),h=[],m=!1;for(let _=0;_<f.length;_++){let b=f[_];Tp(b,p)?h.push(b):m=!0}if(m&&h.length>0)if(n){let _=h[0];U(_)?_.selectStart():_.getParentOrThrow().selectStart()}else{let _=h[h.length-1];U(_)?_.selectEnd():_.getParentOrThrow().selectEnd()}s.anchorNode===d.startContainer&&s.anchorOffset===d.startOffset||(function(_){let b=_.focus,y=_.anchor,x=y.key,v=y.offset,E=y.type;y.set(b.key,b.offset,b.type,!0),b.set(x,v,E,!0)})(this)}}o==="lineboundary"&&Gk(this,e,n,o,"decorators")}forwardDeletion(e,n,o){if(!o&&(e.type==="element"&&U(n)&&e.offset===n.getChildrenSize()||e.type==="text"&&e.offset===n.getTextContentSize())){let r=n.getParent(),i=n.getNextSibling()||(r===null?null:r.getNextSibling());if(U(i)&&i.isShadowRoot())return!0}return!1}deleteCharacter(e){let n=this.isCollapsed();if(this.isCollapsed()){let o=this.anchor,r=o.getNode();if(this.forwardDeletion(o,r,e))return;let i=by(fi(o,e?"previous":"next"));if(i.getTextSlices().every((a=>a===null||a.distance===0))){let a={type:"initial"};for(let l of i.iterNodeCarets("shadowRoot"))if(yo(l)){if(!l.origin.isInline()){if(l.origin.isShadowRoot()){if(a.type==="merge-block")break;if(U(i.anchor.origin)&&i.anchor.origin.isEmpty()){let c=_o(l);bc(this,pi(c,c)),i.anchor.origin.remove()}return}a.type!=="merge-next-block"&&a.type!=="merge-block"||(a={block:a.block,caret:l,type:"merge-block"})}}else{if(a.type==="merge-block")break;if(fs(l)){if(U(l.origin)){if(l.origin.isInline()){if(!l.origin.isParentOf(i.anchor.origin))break}else a={block:l.origin,type:"merge-next-block"};continue}if(Ye(l.origin)){if(!l.origin.isIsolated())if(a.type==="merge-next-block"&&(l.origin.isKeyboardSelectable()||!l.origin.isInline())&&U(i.anchor.origin)&&i.anchor.origin.isEmpty()){i.anchor.origin.remove();let c=Qb();c.add(l.origin.getKey()),In(c)}else l.origin.remove();return}break}}if(a.type==="merge-block"){let{caret:l,block:c}=a;return bc(this,pi(!l.origin.isEmpty()&&c.isEmpty()?Ua(Yt(c,l.direction)):i.anchor,l)),this.removeText()}}let s=this.focus;if(this.modify("extend",e,"character"),this.isCollapsed()){if(e&&o.offset===0&&Hk(this,o.getNode()))return}else{let a=s.type==="text"?s.getNode():null;if(r=o.type==="text"?o.getNode():null,a!==null&&a.isSegmented()){let l=s.offset,c=a.getTextContentSize();if(a.is(r)||e&&l!==c||!e&&l!==0)return void Kk(a,e,l)}else if(r!==null&&r.isSegmented()){let l=o.offset,c=r.getTextContentSize();if(r.is(a)||e&&l!==0||!e&&l!==c)return void Kk(r,e,l)}(function(l,c){let d=l.anchor,u=l.focus,p=d.getNode(),f=u.getNode();if(p===f&&d.type==="text"&&u.type==="text"){let h=d.offset,m=u.offset,_=h<m,b=_?h:m,y=_?m:h,x=y-1;b!==x&&(function(v){return!(w1(v)||HK(v))})(p.getTextContent().slice(b,y))&&(c?u.set(u.key,x,u.type):d.set(d.key,x,d.type))}})(this,e)}}if(this.removeText(),e&&!n&&this.isCollapsed()&&this.anchor.type==="element"&&this.anchor.offset===0){let o=this.anchor.getNode();o.isEmpty()&&Nn(o.getParent())&&o.getPreviousSibling()===null&&Hk(this,o)}}deleteLine(e){this.isCollapsed()&&this.modify("extend",e,"lineboundary"),this.isCollapsed()?this.deleteCharacter(e):this.removeText()}deleteWord(e){if(this.isCollapsed()){let n=this.anchor,o=n.getNode();if(this.forwardDeletion(n,o,e))return;this.modify("extend",e,"word")}this.removeText()}isBackward(){return this.focus.isBefore(this.anchor)}getStartEndPoints(){return[this.anchor,this.focus]}};function Ip(t){return t instanceof bp}function zk(t){let e=t.offset;if(t.type==="text")return e;let n=t.getNode();return e===n.getChildrenSize()?n.getTextContent().length:0}function Nb(t){let e=t.getStartEndPoints();if(e===null)return[0,0];let[n,o]=e;return n.type==="element"&&o.type==="element"&&n.key===o.key&&n.offset===o.offset?[0,0]:[zk(n),zk(o)]}function Hk(t,e){for(let n=e;n;n=n.getParent()){if(U(n)){if(n.collapseAtStart(t))return!0;if(vo(n))break}if(n.getPreviousSibling())break}return!1}var HK=(()=>{try{let t=new RegExp("\\p{Emoji}","u"),e=t.test.bind(t);if(e("\u2764\uFE0F")&&e("#\uFE0F\u20E3")&&e("\u{1F44D}"))return e}catch{}return()=>!1})();function Kk(t,e,n){let o=t,r=o.getTextContent().split(/(?=\s)/g),i=r.length,s=0,a=0;for(let c=0;c<i;c++){let d=c===i-1;if(a=s,s+=r[c].length,e&&s===n||s>n||d){r.splice(c,1),d&&(a=void 0);break}}let l=r.join("").trim();l===""?o.remove():(o.setTextContent(l),o.select(a,a))}function Uk(t,e,n,o){let r,i=e;if(yn(t)){let s=!1,a=t.childNodes,l=a.length,c=o._blockCursorElement;i===l&&(s=!0,i=l-1);let d=a[i],u=!1;if(d===c)d=a[i+1],u=!0;else if(c!==null){let p=c.parentNode;t===p&&e>Array.prototype.indexOf.call(p.children,c)&&i--}if(r=Ea(d),te(r))i=oN(r,s);else{let p=Ea(t);if(p===null)return null;if(U(p)){let f=o.getElementByKey(p.getKey());f===null&&V(214),[p,i]=p.getDOMSlot(f).resolveChildIndex(p,f,t,e),U(p)||V(215),s&&i>=p.getChildrenSize()&&(i=Math.max(0,p.getChildrenSize()-1));let m=p.getChildAtIndex(i);if(U(m)&&(function(_,b,y){let x=_.getParent();return y===null||x===null||!x.canBeEmpty()||x!==y.getNode()})(m,0,n)){let _=s?m.getLastDescendant():m.getFirstDescendant();_===null?p=m:(m=_,p=U(m)?m:m.getParentOrThrow()),i=0}te(m)?(r=m,p=null,i=oN(m,s)):m!==p&&s&&!u&&(U(p)||V(216),i=Math.min(p.getChildrenSize(),i+1))}else{let f=p.getIndexWithinParent();i=e===0&&Ye(p)&&Ea(t)===p?f:f+1,p=p.getParentOrThrow()}if(U(p))return xo(p.__key,i,"element")}}else r=Ea(t);return te(r)?xo(r.__key,i,"text"):null}function jk(t,e,n){let o=t.offset,r=t.getNode();if(o===0){let i=r.getPreviousSibling(),s=r.getParent();if(e){if((n||!e)&&i===null&&U(s)&&s.isInline()){let a=s.getPreviousSibling();te(a)&&t.set(a.__key,a.getTextContent().length,"text")}}else U(i)&&!n&&i.isInline()?t.set(i.__key,i.getChildrenSize(),"element"):te(i)&&t.set(i.__key,i.getTextContent().length,"text")}else if(o===r.getTextContent().length){let i=r.getNextSibling(),s=r.getParent();if(e&&U(i)&&i.isInline())t.set(i.__key,0,"element");else if((n||e)&&i===null&&U(s)&&s.isInline()&&!s.canInsertTextAfter()){let a=s.getNextSibling();te(a)&&t.set(a.__key,0,"text")}}}function r1(t,e,n){if(t.type==="text"&&e.type==="text"){let o=t.isBefore(e),r=t.is(e);jk(t,o,r),jk(e,!o,r),r&&e.set(t.key,t.offset,t.type);let i=nt();if(i.isComposing()&&i._compositionKey!==t.key&&de(n)){let s=n.anchor,a=n.focus;t.set(s.key,s.offset,s.type,!0),e.set(a.key,a.offset,a.type,!0)}}}function i1(t,e,n,o,r,i){if(t===null||n===null||!Oc(r,t,n))return null;let s=Uk(t,e,de(i)?i.anchor:null,r);if(s===null)return null;let a=Uk(n,o,de(i)?i.focus:null,r);if(a===null)return null;if(s.type==="element"&&a.type==="element"){let l=Ea(t),c=Ea(n);if(Ye(l)&&Ye(c))return null}return r1(s,a,i),[s,a]}function KK(t){return U(t)&&!t.isInline()}function s1(t,e,n,o,r,i){let s=Mr(),a=new us(xo(t,e,r),xo(n,o,i),0,"");return a.dirty=!0,s._selection=a,a}function a1(){let t=xo("root",0,"element"),e=xo("root",0,"element");return new us(t,e,0,"")}function Qb(){return new bp(new Set)}function UK(t,e){return Mp(null,t,e,null)}function Mp(t,e,n,o){let r=n._window;if(r===null)return null;let i=o||r.event,s=i?i.type:void 0,a=s==="selectionchange",l=!db&&(a||s==="beforeinput"||s==="compositionstart"||s==="compositionend"||s==="click"&&i&&i.detail===3||s==="drop"||s===void 0),c,d,u,p;if(de(t)&&!l)return t.clone();if(e===null)return null;if(c=e.anchorNode,d=e.focusNode,u=e.anchorOffset,p=e.focusOffset,a&&de(t)&&!Oc(n,c,d))return t.clone();let f=i1(c,u,d,p,n,t);if(f===null)return null;let[h,m]=f;return new us(h,m,de(t)?t.format:0,de(t)?t.style:"")}function Fe(){return Mr()._selection}function gs(){return nt()._editorState._selection}function yp(t,e,n,o=1){let r=t.anchor,i=t.focus,s=r.getNode(),a=i.getNode();if(!e.is(s)&&!e.is(a))return;let l=e.__key;if(t.isCollapsed()){let c=r.offset;if(n<=c&&o>0||n<c&&o<0){let d=Math.max(0,c+o);r.set(l,d,"element"),i.set(l,d,"element"),Vk(t)}}else{let c=t.isBackward(),d=c?i:r,u=d.getNode(),p=c?r:i,f=p.getNode();if(e.is(u)){let h=d.offset;(n<=h&&o>0||n<h&&o<0)&&d.set(l,Math.max(0,h+o),"element")}if(e.is(f)){let h=p.offset;(n<=h&&o>0||n<h&&o<0)&&p.set(l,Math.max(0,h+o),"element")}}Vk(t)}function Vk(t){let e=t.anchor,n=e.offset,o=t.focus,r=o.offset,i=e.getNode(),s=o.getNode();if(t.isCollapsed()){if(!U(i))return;let a=i.getChildrenSize(),l=n>=a,c=l?i.getChildAtIndex(a-1):i.getChildAtIndex(n);if(te(c)){let d=0;l&&(d=c.getTextContentSize()),e.set(c.__key,d,"text"),o.set(c.__key,d,"text")}}else{if(U(i)){let a=i.getChildrenSize(),l=n>=a,c=l?i.getChildAtIndex(a-1):i.getChildAtIndex(n);if(te(c)){let d=0;l&&(d=c.getTextContentSize()),e.set(c.__key,d,"text")}}if(U(s)){let a=s.getChildrenSize(),l=r>=a,c=l?s.getChildAtIndex(a-1):s.getChildAtIndex(r);if(te(c)){let d=0;l&&(d=c.getTextContentSize()),o.set(c.__key,d,"text")}}}}function xp(t,e,n,o,r){let i=null,s=0,a=null;o!==null?(i=o.__key,te(o)?(s=o.getTextContentSize(),a="text"):U(o)&&(s=o.getChildrenSize(),a="element")):r!==null&&(i=r.__key,te(r)?a="text":U(r)&&(a="element")),i!==null&&a!==null?t.set(i,s,a):(s=e.getIndexWithinParent(),s===-1&&(s=n.getChildrenSize()),t.set(n.__key,s,"element"))}function Wk(t,e,n,o,r){t.type==="text"?t.set(n,t.offset+(e?0:r),"text"):t.offset>o.getIndexWithinParent()&&t.set(t.key,t.offset-1,"element")}function l1(t,e,n,o,r){try{t.setBaseAndExtent(e,n,o,r)}catch{}}function jK(t,e,n,o,r,i,s){let a=o.anchorNode,l=o.focusNode,c=o.anchorOffset,d=o.focusOffset,u=document.activeElement;if(r.has(h1)&&u!==i||u!==null&&sy(u))return;if(!de(e))return void(t!==null&&Oc(n,a,l)&&o.removeAllRanges());let p=e.anchor,f=e.focus,h=p.key,m=f.key,_=Ra(n,h),b=Ra(n,m),y=p.offset,x=f.offset,v=e.format,E=e.style,C=e.isCollapsed(),k=_,T=b,w=!1;if(p.type==="text"){k=ps(_);let I=p.getNode();w=I.getFormat()!==v||I.getStyle()!==E}else de(t)&&t.anchor.type==="text"&&(w=!0);var S,N,D,O,M;if(f.type==="text"&&(T=ps(b)),k!==null&&T!==null&&(C&&(t===null||w||de(t)&&(t.format!==v||t.style!==E))&&(S=v,N=E,D=y,O=h,M=performance.now(),JN=[S,N,D,O,M]),c!==y||d!==x||a!==k||l!==T||o.type==="Range"&&C||(u!==null&&i.contains(u)||i.focus({preventScroll:!0}),p.type==="element"))){if(l1(o,k,y,T,x),!r.has(g1)&&e.isCollapsed()&&i!==null&&i===document.activeElement){let I=de(e)&&e.anchor.type==="element"?k.childNodes[y]||null:o.rangeCount>0?o.getRangeAt(0):null;if(I!==null){let L;if(I instanceof Text){let K=document.createRange();K.selectNode(I),L=K.getBoundingClientRect()}else L=I.getBoundingClientRect();(function(K,W,q){let B=py(q),se=fy(B);if(B===null||se===null)return;let{top:me,bottom:_t}=W,Zt=0,ut=0,bt=q;for(;bt!==null;){let sn=bt===B.body;if(sn)Zt=0,ut=co(K).innerHeight;else{let Xe=bt.getBoundingClientRect();Zt=Xe.top,ut=Xe.bottom}let ye=0;if(me<Zt?ye=-(Zt-me):_t>ut&&(ye=_t-ut),ye!==0)if(sn)se.scrollBy(0,ye);else{let Xe=bt.scrollTop;bt.scrollTop+=ye;let st=bt.scrollTop-Xe;me-=st,_t-=st}if(sn)break;bt=Mc(bt)}})(n,L,i)}}wb=!0}}function VK(t){let e=Fe()||gs();e===null&&(e=On().selectEnd()),e.insertNodes(t)}function WK(){let t=Fe();return t===null?"":t.getTextContent()}function rb(t){let e=t;t.isCollapsed()||e.removeText();let n=Fe();de(n)&&(e=n),de(e)||V(161);let o=e.anchor,r=o.getNode(),i=o.offset;for(;!kr(r);){let s=r;if([r,i]=GK(r,i),s.is(r))break}return i}function GK(t,e){let n=t.getParent();if(!n){let r=Nr();return On().append(r),r.select(),[On(),0]}if(te(t)){let r=t.splitText(e);if(r.length===0)return[n,t.getIndexWithinParent()];let i=e===0?0:1;return[n,r[0].getIndexWithinParent()+i]}if(!U(t)||e===0)return[n,t.getIndexWithinParent()];let o=t.getChildAtIndex(e);if(o){let r=new us(xo(t.__key,e,"element"),xo(t.__key,e,"element"),0,""),i=t.insertNewAfter(r);i&&i.append(o,...o.getNextSiblings())}return[n,t.getIndexWithinParent()+1]}function Gk(t,e,n,o,r="decorators-and-blocks"){if(e==="move"&&o==="character"&&!t.isCollapsed()){let[d,u]=n===t.isBackward()?[t.focus,t.anchor]:[t.anchor,t.focus];return u.set(d.key,d.offset,d.type),!0}let i=fi(t.focus,n?"previous":"next"),s=o==="lineboundary",a=e==="move",l=i,c=r==="decorators-and-blocks";if(!j1(l)){for(let d of l){c=!1;let{origin:u}=d;if(!Ye(u)||u.isIsolated()||(l=d,!s||!u.isInline()))break}if(c)for(let d of by(i).iterNodeCarets(e==="extend"?"shadowRoot":"root")){if(yo(d))d.origin.isInline()||(l=d);else{if(U(d.origin))continue;Ye(d.origin)&&!d.origin.isInline()&&(l=d)}break}}if(l===i)return!1;if(a&&!s&&Ye(l.origin)&&l.origin.isKeyboardSelectable()){let d=Qb();return d.add(l.origin.getKey()),In(d),!0}return l=_o(l),a&&za(t.anchor,l),za(t.focus,l),c||!s}var Wt=null,Gt=null,Dn=!1,ib=!1,sp=0,Yk={characterData:!0,childList:!0,subtree:!0};function Ha(){return Dn||Wt!==null&&Wt._readOnly}function jt(){Dn&&V(13)}function c1(){sp>99&&V(14)}function Mr(){return Wt===null&&V(195,d1()),Wt}function nt(){return Gt===null&&V(196,d1()),Gt}function d1(){let t=0,e=new Set,n=La.version;if(typeof window<"u")for(let r of document.querySelectorAll("[contenteditable]")){let i=Ic(r);if(Ap(i))t++;else if(i){let s=String(i.constructor.version||"<0.17.1");s===n&&(s+=" (separately built, likely a bundler configuration issue)"),e.add(s)}}let o=` Detected on the page: ${t} compatible editor(s) with version ${n}`;return e.size&&(o+=` and incompatible editors with versions ${Array.from(e).join(", ")}`),o}function YK(){return Gt}function qk(t,e,n){let o=e.__type,r=ry(t,o),i=n.get(o);i===void 0&&(i=Array.from(r.transforms),n.set(o,i));let s=i.length;for(let a=0;a<s&&(i[a](e),e.isAttached());a++);}function Jk(t,e){return t!==void 0&&t.__key!==e&&t.isAttached()}function u1(t,e){if(!e)return;let n=t._updateTags,o=e;Array.isArray(e)||(o=[e]);for(let r of o)n.add(r)}function qK(t){return ey(t,nt()._nodes)}function ey(t,e){let n=t.type,o=e.get(n);o===void 0&&V(17,n);let r=o.klass;t.type!==r.getType()&&V(18,r.name);let i=r.importJSON(t),s=t.children;if(U(i)&&Array.isArray(s))for(let a=0;a<s.length;a++){let l=ey(s[a],e);i.append(l)}return i}function Xk(t,e,n){let o=Wt,r=Dn,i=Gt;Wt=e,Dn=!0,Gt=t;try{return n()}finally{Wt=o,Dn=r,Gt=i}}function Sr(t,e){let n=t._pendingEditorState,o=t._rootElement,r=t._headless||o===null;if(n===null)return;let i=t._editorState,s=i._selection,a=n._selection,l=t._dirtyType!==ls,c=Wt,d=Dn,u=Gt,p=t._updating,f=t._observer,h=null;if(t._pendingEditorState=null,t._editorState=n,!r&&l&&f!==null){Gt=t,Wt=n,Dn=!1,t._updating=!0;try{let C=t._dirtyType,k=t._dirtyElements,T=t._dirtyLeaves;f.disconnect(),h=CK(i,n,t,C,k,T)}catch(C){if(C instanceof Error&&t._onError(C),ib)throw C;return _1(t,null,o,n),yN(t),t._dirtyType=Na,ib=!0,Sr(t,i),void(ib=!1)}finally{f.observe(o,Yk),t._updating=p,Wt=c,Dn=d,Gt=u}}n._readOnly||(n._readOnly=!0);let m=t._dirtyLeaves,_=t._dirtyElements,b=t._normalizedNodes,y=t._updateTags,x=t._deferred;l&&(t._dirtyType=ls,t._cloneNotNeeded.clear(),t._dirtyLeaves=new Set,t._dirtyElements=new Map,t._normalizedNodes=new Set,t._updateTags=new Set),(function(C,k){let T=C._decorators,w=C._pendingDecorators||T,S=k._nodeMap,N;for(N in w)S.has(N)||(w===T&&(w=C1(C)),delete w[N])})(t,n);let v=r?null:Vo(co(t));if(t._editable&&v!==null&&(l||a===null||a.dirty)&&o!==null&&!y.has(m1)){Gt=t,Wt=n;try{if(f!==null&&f.disconnect(),l||a===null||a.dirty){let C=t._blockCursorElement;C!==null&&Ib(C,t,o),jK(s,a,t,v,y,o)}(function(C,k,T){let w=C._blockCursorElement;if(de(T)&&T.isCollapsed()&&T.anchor.type==="element"&&k.contains(document.activeElement)){let S=T.anchor,N=S.getNode(),D=S.offset,O=!1,M=null;if(D===N.getChildrenSize())ab(N.getChildAtIndex(D-1))&&(O=!0);else{let I=N.getChildAtIndex(D);if(I!==null&&ab(I)){let L=I.getPreviousSibling();(L===null||ab(L))&&(O=!0,M=C.getElementByKey(I.__key))}}if(O){let I=C.getElementByKey(N.__key);return w===null&&(C._blockCursorElement=w=(function(L){let K=L.theme,W=document.createElement("div");W.contentEditable="false",W.setAttribute("data-lexical-cursor","true");let q=K.blockCursor;if(q!==void 0){if(typeof q=="string"){let B=dp(q);q=K.blockCursor=B}q!==void 0&&W.classList.add(...q)}return W})(C._config)),k.style.caretColor="transparent",void(M===null?I.appendChild(w):I.insertBefore(w,M))}}w!==null&&Ib(w,C,k)})(t,o,a)}finally{f!==null&&f.observe(o,Yk),Gt=u,Wt=c}}h!==null&&(function(C,k,T,w,S){let N=Array.from(C._listeners.mutation),D=N.length;for(let O=0;O<D;O++){let[M,I]=N[O];for(let L of I){let K=k.get(L);K!==void 0&&M(K,{dirtyLeaves:w,prevEditorState:S,updateTags:T})}}})(t,h,y,m,i),de(a)||a===null||s!==null&&s.is(a)||t.dispatchCommand(Vb,void 0);let E=t._pendingDecorators;E!==null&&(t._decorators=E,t._pendingDecorators=null,mc("decorator",t,!0,E)),(function(C,k,T){let w=nN(k),S=nN(T);w!==S&&mc("textcontent",C,!0,S)})(t,e||i,n),mc("update",t,!0,{dirtyElements:_,dirtyLeaves:m,editorState:n,mutatedNodes:h,normalizedNodes:b,prevEditorState:e||i,tags:y}),(function(C,k){if(C._deferred=[],k.length!==0){let T=C._updating;C._updating=!0;try{for(let w=0;w<k.length;w++)k[w]()}finally{C._updating=T}}})(t,x),(function(C){let k=C._updates;if(k.length!==0){let T=k.shift();if(T){let[w,S]=T;ty(C,w,S)}}})(t)}function mc(t,e,n,...o){let r=e._updating;e._updating=n;try{let i=Array.from(e._listeners[t]);for(let s=0;s<i.length;s++)i[s].apply(null,o)}finally{e._updating=r}}function Zk(t,e){let n=t._updates,o=e||!1;for(;n.length!==0;){let r=n.shift();if(r){let[i,s]=r,a;if(s!==void 0){if(a=s.onUpdate,s.skipTransforms&&(o=!0),s.discrete){let l=t._pendingEditorState;l===null&&V(191),l._flushSync=!0}a&&t._deferred.push(a),u1(t,s.tag)}i()}}return o}function ty(t,e,n){let o=t._updateTags,r,i=!1,s=!1;n!==void 0&&(r=n.onUpdate,u1(t,n.tag),i=n.skipTransforms||!1,s=n.discrete||!1),r&&t._deferred.push(r);let a=t._editorState,l=t._pendingEditorState,c=!1;(l===null||l._readOnly)&&(l=t._pendingEditorState=p1(l||a),c=!0),l._flushSync=s;let d=Wt,u=Dn,p=Gt,f=t._updating;Wt=l,Dn=!1,t._updating=!0,Gt=t;let h=t._headless||t.getRootElement()===null;oy(null);try{c&&(h?a._selection!==null&&(l._selection=a._selection.clone()):l._selection=(function(y,x){let v=y.getEditorState()._selection,E=Vo(co(y));return de(v)||v==null?Mp(v,E,y,x):v.clone()})(t,n&&n.event||null));let _=t._compositionKey;e(),i=Zk(t,i),(function(y,x){let v=x.getEditorState()._selection,E=y._selection;if(de(E)){let C=E.anchor,k=E.focus,T;if(C.type==="text"&&(T=C.getNode(),T.selectionTransform(v,E)),k.type==="text"){let w=k.getNode();T!==w&&w.selectionTransform(v,E)}}})(l,t),t._dirtyType!==ls&&(i?(function(y,x){let v=x._dirtyLeaves,E=y._nodeMap;for(let C of v){let k=E.get(C);te(k)&&k.isAttached()&&k.isSimpleText()&&!k.isUnmergeable()&&Dk(k)}})(l,t):(function(y,x){let v=x._dirtyLeaves,E=x._dirtyElements,C=y._nodeMap,k=ii(),T=new Map,w=v,S=w.size,N=E,D=N.size;for(;S>0||D>0;){if(S>0){x._dirtyLeaves=new Set;for(let O of w){let M=C.get(O);te(M)&&M.isAttached()&&M.isSimpleText()&&!M.isUnmergeable()&&Dk(M),M!==void 0&&Jk(M,k)&&qk(x,M,T),v.add(O)}if(w=x._dirtyLeaves,S=w.size,S>0){sp++;continue}}x._dirtyLeaves=new Set,x._dirtyElements=new Map,N.delete("root")&&N.set("root",!0);for(let O of N){let M=O[0],I=O[1];if(E.set(M,I),!I)continue;let L=C.get(M);L!==void 0&&Jk(L,k)&&qk(x,L,T)}w=x._dirtyLeaves,S=w.size,N=x._dirtyElements,D=N.size,sp++}x._dirtyLeaves=v,x._dirtyElements=E})(l,t),Zk(t),(function(y,x,v,E){let C=y._nodeMap,k=x._nodeMap,T=[];for(let[w]of E){let S=k.get(w);S!==void 0&&(S.isAttached()||(U(S)&&mN(S,w,C,k,T,E),C.has(w)||E.delete(w),T.push(w)))}for(let w of T)k.delete(w);for(let w of v){let S=k.get(w);S===void 0||S.isAttached()||(C.has(w)||v.delete(w),k.delete(w))}})(a,l,t._dirtyLeaves,t._dirtyElements)),_!==t._compositionKey&&(l._flushSync=!0);let b=l._selection;if(de(b)){let y=l._nodeMap,x=b.anchor.key,v=b.focus.key;y.get(x)!==void 0&&y.get(v)!==void 0||V(19)}else Ip(b)&&b._nodes.size===0&&(l._selection=null)}catch(_){return _ instanceof Error&&t._onError(_),t._pendingEditorState=a,t._dirtyType=Na,t._cloneNotNeeded.clear(),t._dirtyLeaves=new Set,t._dirtyElements.clear(),void Sr(t)}finally{Wt=d,Dn=u,Gt=p,t._updating=f,sp=0}t._dirtyType!==ls||t._deferred.length>0||(function(_,b){let y=b.getEditorState()._selection,x=_._selection;if(x!==null){if(x.dirty||!x.is(y))return!0}else if(y!==null)return!0;return!1})(l,t)?l._flushSync?(l._flushSync=!1,Sr(t)):c&&cU((()=>{Sr(t)})):(l._flushSync=!1,c&&(o.clear(),t._deferred=[],t._pendingEditorState=null))}function Yn(t,e,n){Gt===t&&n===void 0?e():ty(t,e,n)}var Db=class t{constructor(e,n,o){this.element=e,this.before=n||null,this.after=o||null}withBefore(e){return new t(this.element,e,this.after)}withAfter(e){return new t(this.element,this.before,e)}withElement(e){return this.element===e?this:new t(e,this.before,this.after)}insertChild(e){let n=this.before||this.getManagedLineBreak();return n!==null&&n.parentElement!==this.element&&V(222),this.element.insertBefore(e,n),this}removeChild(e){return e.parentElement!==this.element&&V(223),this.element.removeChild(e),this}replaceChild(e,n){return n.parentElement!==this.element&&V(224),this.element.replaceChild(e,n),this}getFirstChild(){let e=this.after?this.after.nextSibling:this.element.firstChild;return e===this.before||e===this.getManagedLineBreak()?null:e}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(e){if(e===null)this.removeManagedLineBreak();else{let n=e==="decorator"&&(ka||yc);this.insertManagedLineBreak(n)}}removeManagedLineBreak(){let e=this.getManagedLineBreak();if(e){let n=this.element,o=e.nodeName==="IMG"?e.nextSibling:null;o&&n.removeChild(o),n.removeChild(e),n.__lexicalLineBreak=void 0}}insertManagedLineBreak(e){let n=this.getManagedLineBreak();if(n){if(e===(n.nodeName==="IMG"))return;this.removeManagedLineBreak()}let o=this.element,r=this.before,i=document.createElement("br");if(o.insertBefore(i,r),e){let s=document.createElement("img");s.setAttribute("data-lexical-linebreak","true"),s.style.cssText="display: inline !important; border: 0px !important; margin: 0px !important;",s.alt="",o.insertBefore(s,i),o.__lexicalLineBreak=s}else o.__lexicalLineBreak=i}getFirstChildOffset(){let e=0;for(let n=this.after;n!==null;n=n.previousSibling)e++;return e}resolveChildIndex(e,n,o,r){if(o===this.element){let l=this.getFirstChildOffset();return[e,Math.min(l+e.getChildrenSize(),Math.max(l,r))]}let i=Qk(n,o);i.push(r);let s=Qk(n,this.element),a=e.getIndexWithinParent();for(let l=0;l<s.length;l++){let c=i[l],d=s[l];if(c===void 0||c<d)break;if(c>d){a+=1;break}}return[e.getParentOrThrow(),a]}};function Qk(t,e){let n=[],o=e;for(;o!==t&&o!==null;o=o.parentNode){let r=0;for(let i=o.previousSibling;i!==null;i=i.previousSibling)r++;n.push(r)}return o!==t&&V(225),n.reverse()}var di=class extends ci{constructor(e){super(e),this.__first=null,this.__last=null,this.__size=0,this.__format=0,this.__style="",this.__indent=0,this.__dir=null,this.__textFormat=0,this.__textStyle=""}afterCloneFrom(e){super.afterCloneFrom(e),this.__key===e.__key&&(this.__first=e.__first,this.__last=e.__last,this.__size=e.__size),this.__indent=e.__indent,this.__format=e.__format,this.__style=e.__style,this.__dir=e.__dir,this.__textFormat=e.__textFormat,this.__textStyle=e.__textStyle}getFormat(){return this.getLatest().__format}getFormatType(){let e=this.getFormat();return aK[e]||""}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){let e=[],n=this.getFirstChild();for(;n!==null;)e.push(n),n=n.getNextSibling();return e}getChildrenKeys(){let e=[],n=this.getFirstChild();for(;n!==null;)e.push(n.__key),n=n.getNextSibling();return e}getChildrenSize(){return this.getLatest().__size}isEmpty(){return this.getChildrenSize()===0}isDirty(){let e=nt()._dirtyElements;return e!==null&&e.has(this.__key)}isLastChild(){let e=this.getLatest(),n=this.getParentOrThrow().getLastChild();return n!==null&&n.is(e)}getAllTextNodes(){let e=[],n=this.getFirstChild();for(;n!==null;){if(te(n)&&e.push(n),U(n)){let o=n.getAllTextNodes();e.push(...o)}n=n.getNextSibling()}return e}getFirstDescendant(){let e=this.getFirstChild();for(;U(e);){let n=e.getFirstChild();if(n===null)break;e=n}return e}getLastDescendant(){let e=this.getLastChild();for(;U(e);){let n=e.getLastChild();if(n===null)break;e=n}return e}getDescendantByIndex(e){let n=this.getChildren(),o=n.length;if(e>=o){let i=n[o-1];return U(i)&&i.getLastDescendant()||i||null}let r=n[e];return U(r)&&r.getFirstDescendant()||r||null}getFirstChild(){let e=this.getLatest().__first;return e===null?null:Lt(e)}getFirstChildOrThrow(){let e=this.getFirstChild();return e===null&&V(45,this.__key),e}getLastChild(){let e=this.getLatest().__last;return e===null?null:Lt(e)}getLastChildOrThrow(){let e=this.getLastChild();return e===null&&V(96,this.__key),e}getChildAtIndex(e){let n=this.getChildrenSize(),o,r;if(e<n/2){for(o=this.getFirstChild(),r=0;o!==null&&r<=e;){if(r===e)return o;o=o.getNextSibling(),r++}return null}for(o=this.getLastChild(),r=n-1;o!==null&&r>=e;){if(r===e)return o;o=o.getPreviousSibling(),r--}return null}getTextContent(){let e="",n=this.getChildren(),o=n.length;for(let r=0;r<o;r++){let i=n[r];e+=i.getTextContent(),U(i)&&r!==o-1&&!i.isInline()&&(e+=Or)}return e}getTextContentSize(){let e=0,n=this.getChildren(),o=n.length;for(let r=0;r<o;r++){let i=n[r];e+=i.getTextContentSize(),U(i)&&r!==o-1&&!i.isInline()&&(e+=Or.length)}return e}getDirection(){return this.getLatest().__dir}getTextFormat(){return this.getLatest().__textFormat}hasFormat(e){if(e!==""){let n=vk[e];return!!(this.getFormat()&n)}return!1}hasTextFormat(e){let n=ln[e];return!!(this.getTextFormat()&n)}getFormatFlags(e,n){return Ep(this.getLatest().__textFormat,e,n)}getTextStyle(){return this.getLatest().__textStyle}select(e,n){jt();let o=Fe(),r=e,i=n,s=this.getChildrenSize();if(!this.canBeEmpty()){if(e===0&&n===0){let l=this.getFirstChild();if(te(l)||U(l))return l.select(0,0)}else if(!(e!==void 0&&e!==s||n!==void 0&&n!==s)){let l=this.getLastChild();if(te(l)||U(l))return l.select()}}r===void 0&&(r=s),i===void 0&&(i=s);let a=this.__key;return de(o)?(o.anchor.set(a,r,"element"),o.focus.set(a,i,"element"),o.dirty=!0,o):s1(a,r,a,i,"element","element")}selectStart(){let e=this.getFirstDescendant();return e?e.selectStart():this.select()}selectEnd(){let e=this.getLastDescendant();return e?e.selectEnd():this.select()}clear(){let e=this.getWritable();return this.getChildren().forEach((n=>n.remove())),e}append(...e){return this.splice(this.getChildrenSize(),0,e)}setDirection(e){let n=this.getWritable();return n.__dir=e,n}setFormat(e){return this.getWritable().__format=e!==""?vk[e]:0,this}setStyle(e){return this.getWritable().__style=e||"",this}setTextFormat(e){let n=this.getWritable();return n.__textFormat=e,n}setTextStyle(e){let n=this.getWritable();return n.__textStyle=e,n}setIndent(e){return this.getWritable().__indent=e,this}splice(e,n,o){let r=o.length,i=this.getChildrenSize(),s=this.getWritable();e+n<=i||V(226,String(e),String(n),String(i));let a=s.__key,l=[],c=[],d=this.getChildAtIndex(e+n),u=null,p=i-n+r;if(e!==0)if(e===i)u=this.getLastChild();else{let h=this.getChildAtIndex(e);h!==null&&(u=h.getPreviousSibling())}if(n>0){let h=u===null?this.getFirstChild():u.getNextSibling();for(let m=0;m<n;m++){h===null&&V(100);let _=h.getNextSibling(),b=h.__key;ai(h.getWritable()),c.push(b),h=_}}let f=u;for(let h=0;h<r;h++){let m=o[h];f!==null&&m.is(f)&&(u=f=f.getPreviousSibling());let _=m.getWritable();_.__parent===a&&p--,ai(_);let b=m.__key;if(f===null)s.__first=b,_.__prev=null;else{let y=f.getWritable();y.__next=b,_.__prev=y.__key}m.__key===a&&V(76),_.__parent=a,l.push(b),f=m}if(e+n===i)f!==null&&(f.getWritable().__next=null,s.__last=f.__key);else if(d!==null){let h=d.getWritable();if(f!==null){let m=f.getWritable();h.__prev=f.__key,m.__next=d.__key}else h.__prev=null}if(s.__size=p,c.length){let h=Fe();if(de(h)){let m=new Set(c),_=new Set(l),{anchor:b,focus:y}=h;eN(b,m,_)&&xp(b,b.getNode(),this,u,d),eN(y,m,_)&&xp(y,y.getNode(),this,u,d),p!==0||this.canBeEmpty()||vo(this)||this.remove()}}return s}getDOMSlot(e){return new Db(e)}exportDOM(e){let{element:n}=super.exportDOM(e);if(yn(n)){let o=this.getIndent();o>0&&(n.style.paddingInlineStart=40*o+"px");let r=this.getDirection();r&&(n.dir=r)}return{element:n}}exportJSON(){let e={children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),...super.exportJSON()},n=this.getTextFormat(),o=this.getTextStyle();return n!==0&&(e.textFormat=n),o!==""&&(e.textStyle=o),e}updateFromJSON(e){return super.updateFromJSON(e).setFormat(e.format).setIndent(e.indent).setDirection(e.direction).setTextFormat(e.textFormat||0).setTextStyle(e.textStyle||"")}insertNewAfter(e,n){return null}canIndent(){return!0}collapseAtStart(e){return!1}excludeFromCopy(e){return!1}canReplaceWith(e){return!0}canInsertAfter(e){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(e){return!1}extractWithChild(e,n,o){return!1}canMergeWhenEmpty(){return!1}reconcileObservedMutation(e,n){let o=this.getDOMSlot(e),r=o.getFirstChild();for(let i=this.getFirstChild();i;i=i.getNextSibling()){let s=n.getElementByKey(i.getKey());s!==null&&(r==null?(o.insertChild(s),r=s):r!==s&&o.replaceChild(s,r),r=r.nextSibling)}}};function U(t){return t instanceof di}function eN(t,e,n){let o=t.getNode();for(;o;){let r=o.__key;if(e.has(r)&&!n.has(r))return!0;o=o.getParent()}return!1}var Nc=class extends ci{decorate(e,n){V(47)}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}};function Ye(t){return t instanceof Nc}var Ma=class t extends di{static getType(){return"root"}static clone(){return new t}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){V(51)}getTextContent(){let e=this.__cachedText;return!Ha()&&nt()._dirtyType!==ls||e===null?super.getTextContent():e}remove(){V(52)}replace(e){V(53)}insertBefore(e){V(54)}insertAfter(e){V(55)}updateDOM(e,n){return!1}splice(e,n,o){for(let r of o)U(r)||Ye(r)||V(282);return super.splice(e,n,o)}static importJSON(e){return On().updateFromJSON(e)}collapseAtStart(){return!0}};function Nn(t){return t instanceof Ma}function p1(t){return new vp(new Map(t._nodeMap))}function ny(){return new vp(new Map([["root",new Ma]]))}function f1(t){let e=t.exportJSON(),n=t.constructor;if(e.type!==n.getType()&&V(130,n.name),U(t)){let o=e.children;Array.isArray(o)||V(59,n.name);let r=t.getChildren();for(let i=0;i<r.length;i++){let s=f1(r[i]);o.push(s)}}return e}var vp=class t{constructor(e,n){this._nodeMap=e,this._selection=n||null,this._flushSync=!1,this._readOnly=!1}isEmpty(){return this._nodeMap.size===1&&this._selection===null}read(e,n){return Xk(n&&n.editor||null,this,e)}clone(e){let n=new t(this._nodeMap,e===void 0?this._selection:e);return n._readOnly=!0,n}toJSON(){return Xk(null,this,(()=>({root:f1(On())})))}},JK="historic",XK="history-push",ap="history-merge",ZK="paste",h1="collaboration",QK="skip-collab",g1="skip-scroll-into-view",m1="skip-dom-selection",Cp=class extends di{static getType(){return"artificial"}createDOM(e){return document.createElement("div")}},Aa=class t extends di{static getType(){return"paragraph"}static clone(e){return new t(e.__key)}createDOM(e){let n=document.createElement("p"),o=Sa(e.theme,"paragraph");return o!==void 0&&n.classList.add(...o),n}updateDOM(e,n,o){return!1}static importDOM(){return{p:e=>({conversion:eU,priority:0})}}exportDOM(e){let{element:n}=super.exportDOM(e);if(yn(n)){this.isEmpty()&&n.append(document.createElement("br"));let o=this.getFormatType();o&&(n.style.textAlign=o)}return{element:n}}static importJSON(e){return Nr().updateFromJSON(e)}exportJSON(){return{...super.exportJSON(),textFormat:this.getTextFormat(),textStyle:this.getTextStyle()}}insertNewAfter(e,n){let o=Nr();o.setTextFormat(e.format),o.setTextStyle(e.style);let r=this.getDirection();return o.setDirection(r),o.setFormat(this.getFormatType()),o.setStyle(this.getStyle()),this.insertAfter(o,n),o}collapseAtStart(){let e=this.getChildren();if(e.length===0||te(e[0])&&e[0].getTextContent().trim()===""){if(this.getNextSibling()!==null)return this.selectNext(),this.remove(),!0;if(this.getPreviousSibling()!==null)return this.selectPrevious(),this.remove(),!0}return!1}};function eU(t){let e=Nr();return t.style&&(e.setFormat(t.style.textAlign),B1(t,e)),{node:e}}function Nr(){return Ac(new Aa)}function tU(t){return t instanceof Aa}var nU=0,oU=1,rU=2,iU=3,sU=4;function _1(t,e,n,o){let r=t._keyToDOMMap;r.clear(),t._editorState=ny(),t._pendingEditorState=o,t._compositionKey=null,t._dirtyType=ls,t._cloneNotNeeded.clear(),t._dirtyLeaves=new Set,t._dirtyElements.clear(),t._normalizedNodes=new Set,t._updateTags=new Set,t._updates=[],t._blockCursorElement=null;let i=t._observer;i!==null&&(i.disconnect(),t._observer=null),e!==null&&(e.textContent=""),n!==null&&(n.textContent="",r.set("root",n))}function aU(t){let e=t||{},n=YK(),o=e.theme||{},r=t===void 0?n:e.parentEditor||null,i=e.disableEvents||!1,s=ny(),a=e.namespace||(r!==null?r._config.namespace:T1()),l=e.editorState,c=[Ma,ds,Da,Ia,Aa,Cp,...e.nodes||[]],{onError:d,html:u}=e,p=e.editable===void 0||e.editable,f;if(t===void 0&&n!==null)f=n._nodes;else{f=new Map;for(let m=0;m<c.length;m++){let _=c[m],b=null,y=null;if(typeof _!="function"){let k=_;_=k.replace,b=k.with,y=k.withKlass||null}let{ownNodeConfig:x}=my(_),v=_.getType(),E=_.transform(),C=new Set;x&&x.$transform&&C.add(x.$transform),E!==null&&C.add(E),f.set(v,{exportDOM:u&&u.export?u.export.get(_):void 0,klass:_,replace:b,replaceWithKlass:y,sharedNodeState:xN(c[m]),transforms:C})}}let h=new La(s,r,f,{disableEvents:i,namespace:a,theme:o},d||console.error,(function(m,_){let b=new Map,y=new Set,x=v=>{Object.keys(v).forEach((E=>{let C=b.get(E);C===void 0&&(C=[],b.set(E,C)),C.push(v[E])}))};return m.forEach((v=>{let E=v.klass.importDOM;if(E==null||y.has(E))return;y.add(E);let C=E.call(v.klass);C!==null&&x(C)})),_&&x(_),b})(f,u?u.import:void 0),p,t);return l!==void 0&&(h._pendingEditorState=l,h._dirtyType=Na),h}var La=class{constructor(e,n,o,r,i,s,a,l){this._createEditorArgs=l,this._parentEditor=n,this._rootElement=null,this._editorState=e,this._pendingEditorState=null,this._compositionKey=null,this._deferred=[],this._keyToDOMMap=new Map,this._updates=[],this._updating=!1,this._listeners={decorator:new Set,editable:new Set,mutation:new Map,root:new Set,textcontent:new Set,update:new Set},this._commands=new Map,this._config=r,this._nodes=o,this._decorators={},this._pendingDecorators=null,this._dirtyType=ls,this._cloneNotNeeded=new Set,this._dirtyLeaves=new Set,this._dirtyElements=new Map,this._normalizedNodes=new Set,this._updateTags=new Set,this._observer=null,this._key=T1(),this._onError=i,this._htmlConversions=s,this._editable=a,this._headless=n!==null&&n._headless,this._window=null,this._blockCursorElement=null}isComposing(){return this._compositionKey!=null}registerUpdateListener(e){let n=this._listeners.update;return n.add(e),()=>{n.delete(e)}}registerEditableListener(e){let n=this._listeners.editable;return n.add(e),()=>{n.delete(e)}}registerDecoratorListener(e){let n=this._listeners.decorator;return n.add(e),()=>{n.delete(e)}}registerTextContentListener(e){let n=this._listeners.textcontent;return n.add(e),()=>{n.delete(e)}}registerRootListener(e){let n=this._listeners.root;return e(this._rootElement,null),n.add(e),()=>{e(null,this._rootElement),n.delete(e)}}registerCommand(e,n,o){o===void 0&&V(35);let r=this._commands;r.has(e)||r.set(e,[new Set,new Set,new Set,new Set,new Set]);let i=r.get(e);i===void 0&&V(36,String(e));let s=i[o];return s.add(n),()=>{s.delete(n),i.every((a=>a.size===0))&&r.delete(e)}}registerMutationListener(e,n,o){let r=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(e)).klass,i=this._listeners.mutation,s=i.get(n);s===void 0&&(s=new Set,i.set(n,s)),s.add(r);let a=o&&o.skipInitialization;return a!==void 0&&a||this.initializeMutationListener(n,r),()=>{s.delete(r),s.size===0&&i.delete(n)}}getRegisteredNode(e){let n=this._nodes.get(e.getType());return n===void 0&&V(37,e.name),n}resolveRegisteredNodeAfterReplacements(e){for(;e.replaceWithKlass;)e=this.getRegisteredNode(e.replaceWithKlass);return e}initializeMutationListener(e,n){let o=this._editorState,r=Ab(o).get(n.getType());if(!r)return;let i=new Map;for(let s of r.keys())i.set(s,"created");i.size>0&&e(i,{dirtyLeaves:new Set,prevEditorState:o,updateTags:new Set(["registerMutationListener"])})}registerNodeTransformToKlass(e,n){let o=this.getRegisteredNode(e);return o.transforms.add(n),o}registerNodeTransform(e,n){let o=this.registerNodeTransformToKlass(e,n),r=[o],i=o.replaceWithKlass;if(i!=null){let s=this.registerNodeTransformToKlass(i,n);r.push(s)}return(function(s,a){let l=Ab(s.getEditorState()),c=[];for(let d of a){let u=l.get(d);u&&c.push(u)}c.length!==0&&s.update((()=>{for(let d of c)for(let u of d.keys()){let p=Lt(u);p&&p.markDirty()}}),s._pendingEditorState===null?{tag:ap}:void 0)})(this,r.map((s=>s.klass.getType()))),()=>{r.forEach((s=>s.transforms.delete(n)))}}hasNode(e){return this._nodes.has(e.getType())}hasNodes(e){return e.every(this.hasNode.bind(this))}dispatchCommand(e,n){return Z(this,e,n)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(e){let n=this._rootElement;if(e!==n){let o=Sa(this._config.theme,"root"),r=this._pendingEditorState||this._editorState;if(this._rootElement=e,_1(this,n,e,r),n!==null&&(this._config.disableEvents||AK(n),o!=null&&n.classList.remove(...o)),e!==null){let i=fy(e),s=e.style;s.userSelect="text",s.whiteSpace="pre-wrap",s.wordBreak="break-word",e.setAttribute("data-lexical-editor","true"),this._window=i,this._dirtyType=Na,yN(this),this._updateTags.add(ap),Sr(this),this._config.disableEvents||(function(a,l){let c=a.ownerDocument,d=_p.get(c);(d===void 0||d<1)&&c.addEventListener("selectionchange",t1),_p.set(c,(d||0)+1),a.__lexicalEditor=l;let u=e1(a);for(let p=0;p<Eb.length;p++){let[f,h]=Eb[p],m=typeof h=="function"?_=>{Rk(_)||(Lk(_),(l.isEditable()||f==="click")&&h(_,l))}:_=>{if(Rk(_))return;Lk(_);let b=l.isEditable();switch(f){case"cut":return b&&Z(l,Jb,_);case"copy":return Z(l,qb,_);case"paste":return b&&Z(l,Wb,_);case"dragstart":return b&&Z(l,KN,_);case"dragover":return b&&Z(l,UN,_);case"dragend":return b&&Z(l,jN,_);case"focus":return b&&Z(l,VN,_);case"blur":return b&&Z(l,WN,_);case"drop":return b&&Z(l,HN,_)}};a.addEventListener(f,m),u.push((()=>{a.removeEventListener(f,m)}))}})(e,this),o!=null&&e.classList.add(...o)}else this._window=null,this._updateTags.add(ap),Sr(this);mc("root",this,!1,e,n)}}getElementByKey(e){return this._keyToDOMMap.get(e)||null}getEditorState(){return this._editorState}setEditorState(e,n){e.isEmpty()&&V(38);let o=e;o._readOnly&&(o=p1(e),o._selection=e._selection?e._selection.clone():null),bN(this);let r=this._pendingEditorState,i=this._updateTags,s=n!==void 0?n.tag:null;r===null||r.isEmpty()||(s!=null&&i.add(s),Sr(this)),this._pendingEditorState=o,this._dirtyType=Na,this._dirtyElements.set("root",!1),this._compositionKey=null,s!=null&&i.add(s),this._updating||Sr(this)}parseEditorState(e,n){return(function(o,r,i){let s=ny(),a=Wt,l=Dn,c=Gt,d=r._dirtyElements,u=r._dirtyLeaves,p=r._cloneNotNeeded,f=r._dirtyType;r._dirtyElements=new Map,r._dirtyLeaves=new Set,r._cloneNotNeeded=new Set,r._dirtyType=0,Wt=s,Dn=!1,Gt=r,oy(null);try{let h=r._nodes;ey(o.root,h),i&&i(),s._readOnly=!0}catch(h){h instanceof Error&&r._onError(h)}finally{r._dirtyElements=d,r._dirtyLeaves=u,r._cloneNotNeeded=p,r._dirtyType=f,Wt=a,Dn=l,Gt=c}return s})(typeof e=="string"?JSON.parse(e):e,this,n)}read(e){return Sr(this),this.getEditorState().read(e,{editor:this})}update(e,n){(function(o,r,i){o._updating?o._updates.push([r,i]):ty(o,r,i)})(this,e,n)}focus(e,n={}){let o=this._rootElement;o!==null&&(o.setAttribute("autocapitalize","off"),Yn(this,(()=>{let r=Fe(),i=On();r!==null?r.dirty||In(r.clone()):i.getChildrenSize()!==0&&(n.defaultSelection==="rootStart"?i.selectStart():i.selectEnd()),O1("focus"),I1((()=>{o.removeAttribute("autocapitalize"),e&&e()}))})),this._pendingEditorState===null&&o.removeAttribute("autocapitalize"))}blur(){let e=this._rootElement;e!==null&&e.blur();let n=Vo(this._window);n!==null&&n.removeAllRanges()}isEditable(){return this._editable}setEditable(e){this._editable!==e&&(this._editable=e,mc("editable",this,!0,e))}toJSON(){return{editorState:this._editorState.toJSON()}}};La.version="0.33.1+prod.esm";var Ob=null;function oy(t){Ob=t}var b1=1;function lU(){b1=1}function ry(t,e){let n=iy(t,e);return n===void 0&&V(30,e),n}function iy(t,e){return t._nodes.get(e)}var cU=typeof queueMicrotask=="function"?queueMicrotask:t=>{Promise.resolve().then(t)};function tN(t){return Ye(Rp(t))}function sy(t){let e=document.activeElement;if(!yn(e))return!1;let n=e.nodeName;return Ye(Rp(t))&&(n==="INPUT"||n==="TEXTAREA"||e.contentEditable==="true"&&Ic(e)==null)}function Oc(t,e,n){let o=t.getRootElement();try{return o!==null&&o.contains(e)&&o.contains(n)&&e!==null&&!sy(e)&&ay(e)===t}catch{return!1}}function Ap(t){return t instanceof La}function ay(t){let e=t;for(;e!=null;){let n=Ic(e);if(Ap(n))return n;e=Mc(e)}return null}function Ic(t){return t?t.__lexicalEditor:null}function si(t){return Zb(t)||t.isToken()}function wr(t){return si(t)||t.isSegmented()}function Wo(t){return Ka(t)&&t.nodeType===W6}function y1(t){return Ka(t)&&t.nodeType===G6}function ps(t){let e=t;for(;e!=null;){if(Wo(e))return e;e=e.firstChild}return null}function Ep(t,e,n){let o=ln[e];if(n!==null&&(t&o)==(n&o))return t;let r=t^o;return e==="subscript"?r&=~ln.superscript:e==="superscript"?r&=~ln.subscript:e==="lowercase"?(r&=~ln.uppercase,r&=~ln.capitalize):e==="uppercase"?(r&=~ln.lowercase,r&=~ln.capitalize):e==="capitalize"&&(r&=~ln.lowercase,r&=~ln.uppercase),r}function dU(t){return te(t)||ss(t)||Ye(t)}function x1(t,e){let n=(function(){let s=Ob;return Ob=null,s})();if((e=e||n&&n.__key)!=null)return void(t.__key=e);jt(),c1();let o=nt(),r=Mr(),i=""+b1++;r._nodeMap.set(i,t),U(t)?o._dirtyElements.set(i,!0):o._dirtyLeaves.add(i),o._cloneNotNeeded.add(i),o._dirtyType=pN,t.__key=i}function ai(t){let e=t.getParent();if(e!==null){let n=t.getWritable(),o=e.getWritable(),r=t.getPreviousSibling(),i=t.getNextSibling(),s=i!==null?i.__key:null,a=r!==null?r.__key:null,l=r!==null?r.getWritable():null,c=i!==null?i.getWritable():null;r===null&&(o.__first=s),i===null&&(o.__last=a),l!==null&&(l.__next=s),c!==null&&(c.__prev=a),n.__prev=null,n.__next=null,n.__parent=null,o.__size--}}function wp(t){c1();let e=t.getLatest(),n=e.__parent,o=Mr(),r=nt(),i=o._nodeMap,s=r._dirtyElements;n!==null&&(function(l,c,d){let u=l;for(;u!==null;){if(d.has(u))return;let p=c.get(u);if(p===void 0)break;d.set(u,!1),u=p.__parent}})(n,i,s);let a=e.__key;r._dirtyType=pN,U(t)?s.set(a,!0):r._dirtyLeaves.add(a)}function Vt(t){jt();let e=nt(),n=e._compositionKey;if(t!==n){if(e._compositionKey=t,n!==null){let o=Lt(n);o!==null&&o.getWritable()}if(t!==null){let o=Lt(t);o!==null&&o.getWritable()}}}function ii(){return Ha()?null:nt()._compositionKey}function Lt(t,e){let n=(e||Mr())._nodeMap.get(t);return n===void 0?null:n}function v1(t,e){let n=Lp(t,nt());return n!==void 0?Lt(n,e):null}function Lp(t,e){return t[`__lexicalKey_${e._key}`]}function Rp(t,e){let n=t;for(;n!=null;){let o=v1(n,e);if(o!==null)return o;n=Mc(n)}return null}function C1(t){let e=t._decorators,n=Object.assign({},e);return t._pendingDecorators=n,n}function nN(t){return t.read((()=>On().getTextContent()))}function On(){return E1(Mr())}function E1(t){return t._nodeMap.get("root")}function In(t){jt();let e=Mr();t!==null&&(t.dirty=!0,t.setCachedNodes(null)),e._selection=t}function Ea(t){let e=nt(),n=(function(o,r){let i=o;for(;i!=null;){let s=Lp(i,r);if(s!==void 0)return s;i=Mc(i)}return null})(t,e);return n===null?t===e.getRootElement()?Lt("root"):null:Lt(n)}function oN(t,e){return e?t.getTextContentSize():0}function w1(t){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(t)}function ly(t){let e=[],n=t;for(;n!==null;)e.push(n),n=n._parentEditor;return e}function T1(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,5)}function S1(t){return Wo(t)?t.nodeValue:null}function cy(t,e,n){let o=Vo(co(e));if(o===null)return;let r=o.anchorNode,{anchorOffset:i,focusOffset:s}=o;if(r!==null){let a=S1(r),l=Rp(r);if(a!==null&&te(l)){if(a===Np&&n){let c=n.length;a=n,i=c,s=c}a!==null&&dy(l,a,i,s,t)}}}function dy(t,e,n,o,r){let i=t;if(i.isAttached()&&(r||!i.isDirty())){let s=i.isComposing(),a=e;(s||r)&&e[e.length-1]===Np&&(a=e.slice(0,-1));let l=i.getTextContent();if(r||a!==l){if(a===""){if(Vt(null),yc||ka||cp)i.remove();else{let m=nt();setTimeout((()=>{m.update((()=>{i.isAttached()&&i.remove()}))}),20)}return}let c=i.getParent(),d=gs(),u=i.getTextContentSize(),p=ii(),f=i.getKey();if(i.isToken()||p!==null&&f===p&&!s||de(d)&&(c!==null&&!c.canInsertTextBefore()&&d.anchor.offset===0||d.anchor.key===t.__key&&d.anchor.offset===0&&!i.canInsertTextBefore()&&!s||d.focus.key===t.__key&&d.focus.offset===u&&!i.canInsertTextAfter()&&!s))return void i.markDirty();let h=Fe();if(!de(h)||n===null||o===null)return void i.setTextContent(a);if(h.setTextNodeRange(i,n,i,o),i.isSegmented()){let m=Ut(i.getTextContent());i.replace(m),i=m}i.setTextContent(a)}}}function np(t,e,n){let o=e[n]||!1;return o==="any"||o===t[n]}function k1(t,e){return np(t,e,"altKey")&&np(t,e,"ctrlKey")&&np(t,e,"shiftKey")&&np(t,e,"metaKey")}function je(t,e,n){return k1(t,n)&&t.key.toLowerCase()===e.toLowerCase()}var Er={ctrlKey:!jo,metaKey:jo},rN={altKey:jo,ctrlKey:!jo};function iN(t){return t.key==="Backspace"}function sN(t){return je(t,"a",Er)}function uU(t){let e=On();if(de(t)){let n=t.anchor,o=t.focus,r=n.getNode().getTopLevelElementOrThrow().getParentOrThrow();return n.set(r.getKey(),0,"element"),o.set(r.getKey(),r.getChildrenSize(),"element"),pp(t),t}{let n=e.select(0,e.getChildrenSize());return In(pp(n)),n}}function Sa(t,e){t.__lexicalClassNameCache===void 0&&(t.__lexicalClassNameCache={});let n=t.__lexicalClassNameCache,o=n[e];if(o!==void 0)return o;let r=t[e];if(typeof r=="string"){let i=dp(r);return n[e]=i,i}return r}function uy(t,e,n,o,r){if(n.size===0)return;let i=o.__type,s=o.__key,a=e.get(i);a===void 0&&V(33,i);let l=a.klass,c=t.get(l);c===void 0&&(c=new Map,t.set(l,c));let d=c.get(s),u=d==="destroyed"&&r==="created";(d===void 0||u)&&c.set(s,u?"updated":r)}function pU(t){let e=t.getType(),n=Mr();if(n._readOnly){let i=Ab(n).get(e);return i?Array.from(i.values()):[]}let o=n._nodeMap,r=[];for(let[,i]of o)i instanceof t&&i.__type===e&&i.isAttached()&&r.push(i);return r}function aN(t,e,n){let o=t.getParent(),r=n,i=t;return o!==null&&(e&&n===0?(r=i.getIndexWithinParent(),i=o):e||n!==i.getChildrenSize()||(r=i.getIndexWithinParent()+1,i=o)),i.getChildAtIndex(e?r-1:r)}function N1(t,e){let n=t.offset;if(t.type==="element")return aN(t.getNode(),e,n);{let o=t.getNode();if(e&&n===0||!e&&n===o.getTextContentSize()){let r=e?o.getPreviousSibling():o.getNextSibling();return r===null?aN(o.getParentOrThrow(),e,o.getIndexWithinParent()+(e?0:1)):r}}return null}function D1(t){let e=co(t).event,n=e&&e.inputType;return n==="insertFromPaste"||n==="insertFromPasteAsQuotation"}function Z(t,e,n){return(function(o,r,i){let s=ly(o);for(let a=4;a>=0;a--)for(let l=0;l<s.length;l++){let c=s[l],d=c._commands.get(r);if(d!==void 0){let u=d[a];if(u!==void 0){let p=Array.from(u),f=p.length,h=!1;if(Yn(c,(()=>{for(let m=0;m<f;m++)if(p[m](i,o))return void(h=!0)})),h)return h}}}return!1})(t,e,n)}function Pp(t){return!Nn(t)&&!t.isLastChild()&&!t.isInline()}function Ra(t,e){let n=t._keyToDOMMap.get(e);return n===void 0&&V(75,e),n}function Mc(t){let e=t.assignedSlot||t.parentElement;return R1(e)?e.host:e}function py(t){return y1(t)?t:yn(t)?t.ownerDocument:null}function fU(t){return nt()._updateTags.has(t)}function O1(t){jt(),nt()._updateTags.add(t)}function I1(t){jt(),nt()._deferred.push(t)}function Tp(t,e){let n=t.getParent();for(;n!==null;){if(n.is(e))return!0;n=n.getParent()}return!1}function fy(t){let e=py(t);return e?e.defaultView:null}function co(t){let e=t._window;return e===null&&V(78),e}function hU(t){return U(t)&&t.isInline()||Ye(t)&&t.isInline()}function M1(t){let e=t.getParentOrThrow();for(;e!==null;){if(vo(e))return e;e=e.getParentOrThrow()}return e}function vo(t){return Nn(t)||U(t)&&t.isShadowRoot()}function hy(t){let e=t.constructor.clone(t);return x1(e,null),e.afterCloneFrom(t),e}function Ac(t){let e=nt(),n=t.getType(),o=iy(e,n);o===void 0&&V(200,t.constructor.name,n);let{replace:r,replaceWithKlass:i}=o;if(r!==null){let s=r(t),a=s.constructor;return i!==null?s instanceof i||V(201,i.name,i.getType(),a.name,a.getType(),t.constructor.name,n):s instanceof t.constructor&&a!==t.constructor||V(202,a.name,a.getType(),t.constructor.name,n),s.__key===t.__key&&V(203,t.constructor.name,n,a.name,a.getType()),s}return t}function sb(t,e){!Nn(t.getParent())||U(e)||Ye(e)||V(99)}function A1(t){let e=Lt(t);return e===null&&V(63,t),e}function ab(t){return(Ye(t)||U(t)&&!t.canBeEmpty())&&!t.isInline()}function Ib(t,e,n){n.style.removeProperty("caret-color"),e._blockCursorElement=null;let o=t.parentElement;o!==null&&o.removeChild(t)}function Vo(t){return Co?(t||window).getSelection():null}function L1(t){let e=fy(t);return e?e.getSelection():null}function gU(t,e){let n=t.getChildAtIndex(e);n==null&&(n=t),vo(t)&&V(102);let o=s=>{let a=s.getParentOrThrow(),l=vo(a),c=s!==n||l?hy(s):s;if(l)return U(s)&&U(c)||V(133),s.insertAfter(c),[s,c,c];{let[d,u,p]=o(a),f=s.getNextSiblings();return p.append(c,...f),[d,u,c]}},[r,i]=o(n);return[r,i]}function mU(t){return yn(t)&&t.tagName==="A"}function yn(t){return Ka(t)&&t.nodeType===V6}function Ka(t){return typeof t=="object"&&t!==null&&"nodeType"in t&&typeof t.nodeType=="number"}function R1(t){return Ka(t)&&t.nodeType===Y6}function P1(t){let e=new RegExp(/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|mark|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var|#text)$/,"i");return t.nodeName.match(e)!==null}function Mb(t){let e=new RegExp(/^(address|article|aside|blockquote|canvas|dd|div|dl|dt|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hr|li|main|nav|noscript|ol|p|pre|section|table|td|tfoot|ul|video)$/,"i");return t.nodeName.match(e)!==null}function kr(t){if(Ye(t)&&!t.isInline())return!0;if(!U(t)||vo(t))return!1;let e=t.getFirstChild(),n=e===null||ss(e)||te(e)||e.isInline();return!t.isInline()&&t.canBeEmpty()!==!1&&n}function lb(t,e){let n=t;for(;n!==null&&n.getParent()!==null&&!e(n);)n=n.getParentOrThrow();return e(n)?n:null}function gy(){return nt()}var lN=new WeakMap,_U=new Map;function Ab(t){if(!t._readOnly&&t.isEmpty())return _U;t._readOnly||V(192);let e=lN.get(t);return e||(e=(function(n){let o=new Map;for(let[r,i]of n._nodeMap){let s=i.__type,a=o.get(s);a||(a=new Map,o.set(s,a)),a.set(r,i)}return o})(t),lN.set(t,e)),e}function F1(t){let e=t.constructor.clone(t);return e.afterCloneFrom(t),e}function B1(t,e){let n=parseInt(t.style.paddingInlineStart,10)||0,o=Math.round(n/40);e.setIndent(o)}function bU(t){t.__lexicalUnmanaged=!0}function $1(t){return t.__lexicalUnmanaged===!0}function uc(t,e){return(function(n,o){return Object.prototype.hasOwnProperty.call(n,o)})(t,e)&&t[e]!==ci[e]}function my(t){let e=Ck in t.prototype?t.prototype[Ck]():void 0,n=(function(s){return s===Nc||s===di||s===ci})(t),o=!n&&uc(t,"getType")?t.getType():void 0,r,i=o;if(e)if(o)r=e[o];else for(let[s,a]of Object.entries(e))i=s,r=a;if(!n&&i&&(uc(t,"getType")||(t.getType=()=>i),uc(t,"clone")||(t.clone=s=>(oy(s),new t)),uc(t,"importJSON")||(t.importJSON=r&&r.$importJSON||(s=>new t().updateFromJSON(s))),!uc(t,"importDOM")&&r)){let{importDOM:s}=r;s&&(t.importDOM=()=>s)}return{ownNodeConfig:r,ownNodeType:i}}function yU(t){let e=gy();return jt(),new(e.resolveRegisteredNodeAfterReplacements(e.getRegisteredNode(t))).klass}var xU={next:"previous",previous:"next"},Pa=class{constructor(e){this.origin=e}[Symbol.iterator](){return yy({hasNext:fs,initial:this.getAdjacentCaret(),map:e=>e,step:e=>e.getAdjacentCaret()})}getAdjacentCaret(){return Yt(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return Yt(this.origin,this.direction)}remove(){let e=this.getNodeAtCaret();return e&&e.remove(),this}replaceOrInsert(e,n){let o=this.getNodeAtCaret();return e.is(this.origin)||e.is(o)||(o===null?this.insert(e):o.replace(e,n)),this}splice(e,n,o="next"){let r=o===this.direction?n:Array.from(n).reverse(),i=this,s=this.getParentAtCaret(),a=new Map;for(let l=i.getAdjacentCaret();l!==null&&a.size<e;l=l.getAdjacentCaret()){let c=l.origin.getWritable();a.set(c.getKey(),c)}for(let l of r){if(a.size>0){let c=i.getNodeAtCaret();if(c){if(a.delete(c.getKey()),a.delete(l.getKey()),!(c.is(l)||i.origin.is(l))){let d=l.getParent();d&&d.is(s)&&l.remove(),c.replace(l)}}else c===null&&V(263,Array.from(a).join(" "))}else i.insert(l);i=Yt(l,this.direction)}for(let l of a.values())l.remove();return this}},Dc=class t extends Pa{type="child";getLatest(){let e=this.origin.getLatest();return e===this.origin?this:Ir(e,this.direction)}getParentCaret(e="root"){return Yt(_y(this.getParentAtCaret(),e),this.direction)}getFlipped(){let e=gi(this.direction);return Yt(this.getNodeAtCaret(),e)||Ir(this.origin,e)}getParentAtCaret(){return this.origin}getChildCaret(){return this}isSameNodeCaret(e){return e instanceof t&&this.direction===e.direction&&this.origin.is(e.origin)}isSamePointCaret(e){return this.isSameNodeCaret(e)}},vU={root:Nn,shadowRoot:vo};function gi(t){return xU[t]}function _y(t,e="root"){return vU[e](t)?null:t}var Fa=class t extends Pa{type="sibling";getLatest(){let e=this.origin.getLatest();return e===this.origin?this:Yt(e,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return U(this.origin)?Ir(this.origin,this.direction):null}getParentCaret(e="root"){return Yt(_y(this.getParentAtCaret(),e),this.direction)}getFlipped(){let e=gi(this.direction);return Yt(this.getNodeAtCaret(),e)||Ir(this.origin.getParentOrThrow(),e)}isSamePointCaret(e){return e instanceof t&&this.direction===e.direction&&this.origin.is(e.origin)}isSameNodeCaret(e){return(e instanceof t||e instanceof Ba)&&this.direction===e.direction&&this.origin.is(e.origin)}},Ba=class t extends Pa{type="text";constructor(e,n){super(e),this.offset=n}getLatest(){let e=this.origin.getLatest();return e===this.origin?this:ui(e,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(e="root"){return Yt(_y(this.getParentAtCaret(),e),this.direction)}getFlipped(){return ui(this.origin,gi(this.direction),this.offset)}isSamePointCaret(e){return e instanceof t&&this.direction===e.direction&&this.origin.is(e.origin)&&this.offset===e.offset}isSameNodeCaret(e){return(e instanceof Fa||e instanceof t)&&this.direction===e.direction&&this.origin.is(e.origin)}getSiblingCaret(){return Yt(this.origin,this.direction)}};function Dr(t){return t instanceof Ba}function CU(t){return t instanceof Pa}function fs(t){return t instanceof Fa}function yo(t){return t instanceof Dc}var EU={next:class extends Ba{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(t){return this.origin.insertAfter(t),this}},previous:class extends Ba{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(t){return this.origin.insertBefore(t),this}}},wU={next:class extends Fa{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(t){return this.origin.insertAfter(t),this}},previous:class extends Fa{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(t){return this.origin.insertBefore(t),this}}},TU={next:class extends Dc{direction="next";getNodeAtCaret(){return this.origin.getFirstChild()}insert(t){return this.origin.splice(0,0,[t]),this}},previous:class extends Dc{direction="previous";getNodeAtCaret(){return this.origin.getLastChild()}insert(t){return this.origin.splice(this.origin.getChildrenSize(),0,[t]),this}}};function Yt(t,e){return t?new wU[e](t):null}function ui(t,e,n){return t?new EU[e](t,hs(t,n)):null}function hs(t,e){let n=t.getTextContentSize(),o=e==="next"?n:e==="previous"?0:e;return(o<0||o>n)&&((function(r,...i){let s=new URL("https://lexical.dev/docs/error"),a=new URLSearchParams;a.append("code",r);for(let l of i)a.append("v",l);s.search=a.toString(),console.warn(`Minified Lexical warning #${r}; visit ${s.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)})(284,String(e),String(n),t.getKey()),o=o<0?0:n),o}function Lb(t,e){return new Sp(t,e)}function Ir(t,e){return U(t)?new TU[e](t):null}function z1(t){return t&&t.getChildCaret()||t}function $a(t){return t&&z1(t.getAdjacentCaret())}var Rb=class t{type="node-caret-range";constructor(e,n,o){this.anchor=e,this.focus=n,this.direction=o}getLatest(){let e=this.anchor.getLatest(),n=this.focus.getLatest();return e===this.anchor&&n===this.focus?this:new t(e,n,this.direction)}isCollapsed(){return this.anchor.isSamePointCaret(this.focus)}getTextSlices(){let e=r=>{let i=this[r].getLatest();return Dr(i)?(function(s,a){let{direction:l,origin:c}=s,d=hs(c,a==="focus"?gi(l):l);return Lb(s,d-s.offset)})(i,r):null},n=e("anchor"),o=e("focus");if(n&&o){let{caret:r}=n,{caret:i}=o;if(r.isSameNodeCaret(i))return[Lb(r,i.offset-r.offset),null]}return[n,o]}iterNodeCarets(e="root"){let n=Dr(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),o=this.focus.getLatest(),r=Dr(o),i=s=>s.isSameNodeCaret(o)?null:$a(s)||s.getParentCaret(e);return yy({hasNext:s=>s!==null&&!(r&&o.isSameNodeCaret(s)),initial:n.isSameNodeCaret(o)?null:i(n),map:s=>s,step:i})}[Symbol.iterator](){return this.iterNodeCarets("root")}},Sp=class{type="slice";constructor(e,n){this.caret=e,this.distance=n}getSliceIndices(){let{distance:e,caret:{offset:n}}=this,o=n+e;return o<n?[o,n]:[n,o]}getTextContent(){let[e,n]=this.getSliceIndices();return this.caret.origin.getTextContent().slice(e,n)}getTextContentSize(){return Math.abs(this.distance)}removeTextSlice(){let{caret:{origin:e,direction:n}}=this,[o,r]=this.getSliceIndices(),i=e.getTextContent();return ui(e.setTextContent(i.slice(0,o)+i.slice(r)),n,o)}};function SU(t){return t instanceof Sp}function by(t){return pi(t,Yt(On(),t.direction))}function H1(t){return pi(t,t)}function pi(t,e){return t.direction!==e.direction&&V(265),new Rb(t,e,t.direction)}function yy(t){let{initial:e,hasNext:n,step:o,map:r}=t,i=e;return{[Symbol.iterator](){return this},next(){if(!n(i))return{done:!0,value:void 0};let s={done:!1,value:r(i)};return i=o(i),s}}}function xy(t,e){let n=_c(t.origin,e.origin);switch(n===null&&V(275,t.origin.getKey(),e.origin.getKey()),n.type){case"same":{let o=t.type==="text",r=e.type==="text";return o&&r?(function(i,s){return Math.sign(i-s)})(t.offset,e.offset):t.type===e.type?0:o?-1:r?1:t.type==="child"?-1:1}case"ancestor":return t.type==="child"?-1:1;case"descendant":return e.type==="child"?1:-1;case"branch":return vy(n)}}function vy(t){let{a:e,b:n}=t,o=e.__key,r=n.__key,i=e,s=n;for(;i&&s;i=i.getNextSibling(),s=s.getNextSibling()){if(i.__key===r)return-1;if(s.__key===o)return 1}return i===null?1:-1}function op(t,e){return e.is(t)}function cN(t){return U(t)?[t.getLatest(),null]:[t.getParent(),t.getLatest()]}function _c(t,e){if(t.is(e))return{commonAncestor:t,type:"same"};let n=new Map;for(let[o,r]=cN(t);o;r=o,o=o.getParent())n.set(o,r);for(let[o,r]=cN(e);o;r=o,o=o.getParent()){let i=n.get(o);if(i!==void 0)return i===null?(op(t,o)||V(276),{commonAncestor:o,type:"ancestor"}):r===null?(op(e,o)||V(277),{commonAncestor:o,type:"descendant"}):((U(i)||op(t,i))&&(U(r)||op(e,r))&&o.is(i.getParent())&&o.is(r.getParent())||V(278),{a:i,b:r,commonAncestor:o,type:"branch"})}return null}function fi(t,e){let{type:n,key:o,offset:r}=t,i=A1(t.key);return n==="text"?(te(i)||V(266,i.getType(),o),ui(i,e,r)):(U(i)||V(267,i.getType(),o),V1(i,t.offset,e))}function za(t,e){let{origin:n,direction:o}=e,r=o==="next";Dr(e)?t.set(n.getKey(),e.offset,"text"):fs(e)?te(n)?t.set(n.getKey(),hs(n,o),"text"):t.set(n.getParentOrThrow().getKey(),n.getIndexWithinParent()+(r?1:0),"element"):(yo(e)&&U(n)||V(268),t.set(n.getKey(),r?0:n.getChildrenSize(),"element"))}function K1(t){let e=Fe(),n=de(e)?e:a1();return bc(n,t),In(n),n}function bc(t,e){za(t.anchor,e.anchor),za(t.focus,e.focus)}function Pb(t){let{anchor:e,focus:n}=t,o=fi(e,"next"),r=fi(n,"next"),i=xy(o,r)<=0?"next":"previous";return pi(hi(o,i),hi(r,i))}function Ua(t){let{direction:e,origin:n}=t,o=Yt(n,gi(e)).getNodeAtCaret();return o?Yt(o,e):Ir(n.getParentOrThrow(),e)}function dN(t,e="root"){let n=[t];for(let o=yo(t)?t.getParentCaret(e):t.getSiblingCaret();o!==null;o=o.getParentCaret(e))n.push(Ua(o));return n}function cb(t){return!!t&&t.origin.isAttached()}function U1(t,e="removeEmptySlices"){if(t.isCollapsed())return t;let n="root",o="next",r=e,i=Cy(t,o),s=dN(i.anchor,n),a=dN(i.focus.getFlipped(),n),l=new Set,c=[];for(let h of i.iterNodeCarets(n))if(yo(h))l.add(h.origin.getKey());else if(fs(h)){let{origin:m}=h;U(m)&&!l.has(m.getKey())||c.push(m)}for(let h of c)h.remove();for(let h of i.getTextSlices()){if(!h)continue;let{origin:m}=h.caret,_=m.getTextContentSize(),b=Ua(Yt(m,o)),y=m.getMode();if(Math.abs(h.distance)===_&&r==="removeEmptySlices"||y==="token"&&h.distance!==0)b.remove();else if(h.distance!==0){r="removeEmptySlices";let x=h.removeTextSlice(),v=h.caret.origin;if(y==="segmented"){let E=x.origin,C=Ut(E.getTextContent()).setStyle(E.getStyle()).setFormat(E.getFormat());b.replaceOrInsert(C),x=ui(C,o,x.offset)}v.is(s[0].origin)&&(s[0]=x),v.is(a[0].origin)&&(a[0]=x.getFlipped())}}let d,u;for(let h of s)if(cb(h)){d=_o(h);break}for(let h of a)if(cb(h)){u=_o(h);break}let p=(function(h,m,_){if(!h||!m)return null;let b=h.getParentAtCaret(),y=m.getParentAtCaret();if(!b||!y)return null;let x=b.getParents().reverse();x.push(b);let v=y.getParents().reverse();v.push(y);let E=Math.min(x.length,v.length),C;for(C=0;C<E&&x[C]===v[C];C++);let k=(S,N)=>{let D;for(let O=C;O<S.length;O++){let M=S[O];if(vo(M))return;!D&&N(M)&&(D=M)}return D},T=k(x,kr),w=T&&k(v,(S=>_.has(S.getKey())&&kr(S)));return T&&w?[T,w]:null})(d,u,l);if(p){let[h,m]=p;Ir(h,"previous").splice(0,m.getChildren()),m.remove()}let f=[d,u,...s,...a].find(cb);if(f)return H1(hi(_o(f),t.direction));V(269,JSON.stringify(s.map((h=>h.origin.__key))))}function _o(t){let e=(function(r){let i=r;for(;yo(i);){let s=$a(i);if(!yo(s))break;i=s}return i})(t.getLatest()),{direction:n}=e;if(te(e.origin))return Dr(e)?e:ui(e.origin,n,n);let o=e.getAdjacentCaret();return fs(o)&&te(o.origin)?ui(o.origin,n,gi(n)):e}function j1(t){return Dr(t)&&t.offset!==hs(t.origin,t.direction)}function hi(t,e){return t.direction===e?t:t.getFlipped()}function Cy(t,e){return t.direction===e?t:pi(hi(t.focus,e),hi(t.anchor,e))}function V1(t,e,n){let o=Ir(t,"next");for(let r=0;r<e;r++){let i=o.getAdjacentCaret();if(i===null)break;o=i}return hi(o,n)}function kU(t,e="root"){let n=0,o=t,r=$a(o);for(;r===null;){if(n--,r=o.getParentCaret(e),!r)return null;o=r,r=$a(o)}return r&&[r,n]}function NU(t){let{origin:e,offset:n,direction:o}=t;if(n===hs(e,o))return t.getSiblingCaret();if(n===hs(e,gi(o)))return Ua(t.getSiblingCaret());let[r]=e.splitText(n);return te(r)||V(281),hi(Yt(r,"next"),o)}function DU(t,e){return!0}function OU(t,{$copyElementNode:e=hy,$splitTextPointCaretNext:n=NU,rootMode:o="shadowRoot",$shouldSplit:r=DU}={}){if(Dr(t))return n(t);let i=t.getParentCaret(o);if(i){let{origin:s}=i;if(yo(t)&&(!s.canBeEmpty()||!r(s,"first")))return Ua(i);let a=(function(l){let c=[];for(let d=l.getAdjacentCaret();d;d=d.getAdjacentCaret())c.push(d.origin);return c})(t);(a.length>0||s.canBeEmpty()&&r(s,"last"))&&i.insert(e(s).splice(0,0,a))}return i}var A=Ey,iQ=A.$addUpdateTag,Tt=A.$applyNodeReplacement,mi=A.$caretFromPoint,W1=A.$caretRangeFromSelection,_i=A.$cloneWithProperties,sQ=A.$comparePointCaretNext,aQ=A.$copyNode,lQ=A.$create,Eo=A.$createLineBreakNode,G1=A.$createNodeSelection,fe=A.$createParagraphNode,Go=A.$createPoint,Yo=A.$createRangeSelection,Y1=A.$createRangeSelectionFromDom,wo=A.$createTabNode,vt=A.$createTextNode,Lc=A.$extendCaretToRange,ms=A.$getAdjacentChildCaret,wy=A.$getAdjacentNode,cQ=A.$getAdjacentSiblingOrParentSiblingCaret,Ty=A.$getCaretInDirection,Fp=A.$getCaretRange,q1=A.$getCaretRangeInDirection,J1=A.$getCharacterOffsets,qn=A.$getChildCaret,dQ=A.$getChildCaretAtIndex,Sy=A.$getChildCaretOrSelf,X1=A.$getCollapsedCaretRange,uQ=A.$getCommonAncestor,pQ=A.$getCommonAncestorResultBranchOrder,_s=A.$getEditor,on=A.$getNearestNodeFromDOMNode,fQ=A.$getNearestRootOrShadowRoot,St=A.$getNodeByKey,hQ=A.$getNodeByKeyOrThrow,Ar=A.$getPreviousSelection,Qe=A.$getRoot,$=A.$getSelection,xn=A.$getSiblingCaret,Z1=A.$getState,gQ=A.$getStateChange,mQ=A.$getTextContent,_Q=A.$getTextNodeOffset,Q1=A.$getTextPointCaret,bQ=A.$getTextPointCaretSlice,yQ=A.$getWritableNodeState,eD=A.$hasAncestor,xQ=A.$hasUpdateTag,To=A.$insertNodes,ja=A.$isBlockElementNode,bi=A.$isChildCaret,Mn=A.$isDecoratorNode,G=A.$isElementNode,Bp=A.$isExtendableTextPointCaret,tD=A.$isInlineElementOrDecoratorNode,Rc=A.$isLeafNode,qe=A.$isLineBreakNode,vQ=A.$isNodeCaret,ct=A.$isNodeSelection,qt=A.$isParagraphNode,F=A.$isRangeSelection,qo=A.$isRootNode,Rt=A.$isRootOrShadowRoot,$p=A.$isSiblingCaret,An=A.$isTabNode,Q=A.$isTextNode,zp=A.$isTextPointCaret,CQ=A.$isTextPointCaretSlice,ky=A.$isTokenOrSegmented,EQ=A.$isTokenOrTab,wQ=A.$nodesOfType,Jo=A.$normalizeCaret,Lr=A.$normalizeSelection__EXPERIMENTAL,TQ=A.$onUpdate,nD=A.$parseSerializedNode,SQ=A.$removeTextFromCaretRange,oD=A.$rewindSiblingCaret,Hp=A.$selectAll,kQ=A.$setCompositionKey,yi=A.$setPointFromCaret,gt=A.$setSelection,Kp=A.$setSelectionFromCaretRange,rD=A.$setState,iD=A.$splitAtPointCaretNext,sD=A.$splitNode,NQ=A.$updateRangeSelectionFromCaretRange,Ny=A.ArtificialNode__DO_NOT_USE,DQ=A.BLUR_COMMAND,bs=A.CAN_REDO_COMMAND,ys=A.CAN_UNDO_COMMAND,aD=A.CLEAR_EDITOR_COMMAND,lD=A.CLEAR_HISTORY_COMMAND,Xo=A.CLICK_COMMAND,cD=A.COLLABORATION_TAG,Ct=A.COMMAND_PRIORITY_CRITICAL,Ee=A.COMMAND_PRIORITY_EDITOR,xi=A.COMMAND_PRIORITY_HIGH,Ae=A.COMMAND_PRIORITY_LOW,Up=A.COMMAND_PRIORITY_NORMAL,jp=A.CONTROLLED_TEXT_INSERTION_COMMAND,Vp=A.COPY_COMMAND,Wp=A.CUT_COMMAND,Va=A.DELETE_CHARACTER_COMMAND,Pc=A.DELETE_LINE_COMMAND,Gp=A.DELETE_WORD_COMMAND,OQ=A.DRAGEND_COMMAND,dD=A.DRAGOVER_COMMAND,uD=A.DRAGSTART_COMMAND,pD=A.DROP_COMMAND,Wa=A.DecoratorNode,Pt=A.ElementNode,fD=A.FOCUS_COMMAND,Yp=A.FORMAT_ELEMENT_COMMAND,ot=A.FORMAT_TEXT_COMMAND,Ga=A.HISTORIC_TAG,Ya=A.HISTORY_MERGE_TAG,hD=A.HISTORY_PUSH_TAG,Ln=A.INDENT_CONTENT_COMMAND,Dy=A.INSERT_LINE_BREAK_COMMAND,vi=A.INSERT_PARAGRAPH_COMMAND,xs=A.INSERT_TAB_COMMAND,Fc=A.INTERNAL_$isBlock,IQ=A.IS_ALL_FORMATTING,MQ=A.IS_BOLD,AQ=A.IS_CODE,LQ=A.IS_HIGHLIGHT,RQ=A.IS_ITALIC,PQ=A.IS_STRIKETHROUGH,FQ=A.IS_SUBSCRIPT,BQ=A.IS_SUPERSCRIPT,$Q=A.IS_UNDERLINE,Rr=A.KEY_ARROW_DOWN_COMMAND,qa=A.KEY_ARROW_LEFT_COMMAND,qp=A.KEY_ARROW_RIGHT_COMMAND,So=A.KEY_ARROW_UP_COMMAND,Jp=A.KEY_BACKSPACE_COMMAND,Xp=A.KEY_DELETE_COMMAND,gD=A.KEY_DOWN_COMMAND,mD=A.KEY_ENTER_COMMAND,Ci=A.KEY_ESCAPE_COMMAND,zQ=A.KEY_MODIFIER_COMMAND,Zp=A.KEY_SPACE_COMMAND,Ei=A.KEY_TAB_COMMAND,HQ=A.LineBreakNode,Oy=A.MOVE_TO_END,Qp=A.MOVE_TO_START,KQ=A.NODE_STATE_KEY,uo=A.OUTDENT_CONTENT_COMMAND,wi=A.PASTE_COMMAND,_D=A.PASTE_TAG,UQ=A.ParagraphNode,bD=A.REDO_COMMAND,yD=A.REMOVE_TEXT_COMMAND,xD=A.RootNode,cn=A.SELECTION_CHANGE_COMMAND,Bc=A.SELECTION_INSERT_CLIPBOARD_NODES_COMMAND,vD=A.SELECT_ALL_COMMAND,jQ=A.SKIP_COLLAB_TAG,VQ=A.SKIP_DOM_SELECTION_TAG,WQ=A.SKIP_SCROLL_INTO_VIEW_TAG,CD=A.TEXT_TYPE_TO_FORMAT,GQ=A.TabNode,Ft=A.TextNode,ED=A.UNDO_COMMAND,Iy=A.buildImportMap,Rn=A.createCommand,wD=A.createEditor,YQ=A.createSharedNodeState,qQ=A.createState,JQ=A.flipDirection,XQ=A.getDOMOwnerDocument,Jn=A.getDOMSelection,ZQ=A.getDOMSelectionFromTarget,TD=A.getDOMTextNode,QQ=A.getEditorPropertyFromDOMNode,SD=A.getNearestEditorFromDOMNode,kD=A.getRegisteredNode,eee=A.getRegisteredNodeOrThrow,ND=A.isBlockDomNode,DD=A.isCurrentlyReadOnlyMode,tee=A.isDOMDocumentNode,Ti=A.isDOMNode,nee=A.isDOMTextNode,oee=A.isDOMUnmanaged,My=A.isDocumentFragment,ree=A.isExactShortcutMatch,OD=A.isHTMLAnchorElement,vs=A.isHTMLElement,$c=A.isInlineDomNode,iee=A.isLexicalEditor,Pn=A.isModifierMatch,ID=A.isSelectionCapturedInDecoratorInput,MD=A.isSelectionWithinEditor,Ay=A.makeStepwiseIterator,see=A.removeFromParent,aee=A.resetRandomKey,AD=A.setDOMUnmanaged,Ly=A.setNodeIndentFromDOM;var $y={};Re($y,{$addNodeStyle:()=>RU,$cloneWithProperties:()=>_i,$copyBlockFormatIndent:()=>KD,$ensureForwardRangeSelection:()=>HD,$forEachSelectedTextNode:()=>zD,$getSelectionStyleValueForProperty:()=>UU,$isAtNodeEnd:()=>LU,$isParentElementRTL:()=>VD,$moveCaretSelection:()=>jD,$moveCharacter:()=>HU,$patchStyleText:()=>PU,$selectAll:()=>Hp,$setBlocksType:()=>FU,$shouldOverrideDefaultCharacterSelection:()=>zU,$sliceSelectedTextNodeContent:()=>AU,$trimTextContentFromAnchor:()=>$D,$wrapNodes:()=>$U,createDOMRange:()=>IU,createRectsFromDOMRange:()=>MU,getCSSFromStyleObject:()=>BD,getStyleObjectFromCSS:()=>tf,trimTextContentFromAnchor:()=>jU});function By(t,...e){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",t);for(let r of e)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var ef=new Map;function LD(t){let e=t;for(;e!=null;){if(e.nodeType===Node.TEXT_NODE)return e;e=e.firstChild}return null}function RD(t){let e=t.parentNode;if(e==null)throw new Error("Should never happen");return[e,Array.from(e.childNodes).indexOf(t)]}function IU(t,e,n,o,r){let i=e.getKey(),s=o.getKey(),a=document.createRange(),l=t.getElementByKey(i),c=t.getElementByKey(s),d=n,u=r;if(Q(e)&&(l=LD(l)),Q(o)&&(c=LD(c)),e===void 0||o===void 0||l===null||c===null)return null;l.nodeName==="BR"&&([l,d]=RD(l)),c.nodeName==="BR"&&([c,u]=RD(c));let p=l.firstChild;l===c&&p!=null&&p.nodeName==="BR"&&d===0&&u===0&&(u=1);try{a.setStart(l,d),a.setEnd(c,u)}catch{return null}return!a.collapsed||d===u&&i===s||(a.setStart(c,u),a.setEnd(l,d)),a}function MU(t,e){let n=t.getRootElement();if(n===null)return[];let o=n.getBoundingClientRect(),r=getComputedStyle(n),i=parseFloat(r.paddingLeft)+parseFloat(r.paddingRight),s=Array.from(e.getClientRects()),a,l=s.length;s.sort(((c,d)=>{let u=c.top-d.top;return Math.abs(u)<=3?c.left-d.left:u}));for(let c=0;c<l;c++){let d=s[c],u=a&&a.top<=d.top&&a.top+a.height>d.top&&a.left+a.width>d.left,p=d.width+i===o.width;u||p?(s.splice(c--,1),l--):a=d}return s}function FD(t){let e={};if(!t)return e;let n=t.split(";");for(let o of n)if(o!==""){let[r,i]=o.split(/:([^]+)/);r&&i&&(e[r.trim()]=i.trim())}return e}function tf(t){let e=ef.get(t);return e===void 0&&(e=FD(t),ef.set(t,e)),e}function BD(t){let e="";for(let n in t)n&&(e+=`${n}: ${t[n]};`);return e}function AU(t,e){let n=t.getStartEndPoints();if(e.isSelected(t)&&!ky(e)&&n!==null){let[o,r]=n,i=t.isBackward(),s=o.getNode(),a=r.getNode(),l=e.is(s),c=e.is(a);if(l||c){let[d,u]=J1(t),p=s.is(a),f=e.is(i?a:s),h=e.is(i?s:a),m,_=0;p?(_=d>u?u:d,m=d>u?d:u):f?(_=i?u:d,m=void 0):h&&(_=0,m=i?d:u),e.__text=e.__text.slice(_,m)}}return e}function LU(t){if(t.type==="text")return t.offset===t.getNode().getTextContentSize();let e=t.getNode();return G(e)||By(177),t.offset===e.getChildrenSize()}function $D(t,e,n){let o=e.getNode(),r=n;if(G(o)){let i=o.getDescendantByIndex(e.offset);i!==null&&(o=i)}for(;r>0&&o!==null;){if(G(o)){let c=o.getLastDescendant();c!==null&&(o=c)}let i=o.getPreviousSibling(),s=0;if(i===null){let c=o.getParentOrThrow(),d=c.getPreviousSibling();for(;d===null;){if(c=c.getParent(),c===null){i=null;break}d=c.getPreviousSibling()}c!==null&&(s=c.isInline()?0:2,i=d)}let a=o.getTextContent();a===""&&G(o)&&!o.isInline()&&(a=`
|
|
114
|
-
|
|
115
|
-
`);let l=a.length;if(!Q(o)||r>=l){let c=o.getParent();o.remove(),c==null||c.getChildrenSize()!==0||qo(c)||c.remove(),r-=l+s,o=i}else{let c=o.getKey(),d=t.getEditorState().read((()=>{let f=St(c);return Q(f)&&f.isSimpleText()?f.getTextContent():null})),u=l-r,p=a.slice(0,u);if(d!==null&&d!==a){let f=Ar(),h=o;if(o.isSimpleText())o.setTextContent(d);else{let m=vt(d);o.replace(m),h=m}if(F(f)&&f.isCollapsed()){let m=f.anchor.offset;h.select(m,m)}}else if(o.isSimpleText()){let f=e.key===c,h=e.offset;h<r&&(h=l);let m=f?h-r:0,_=f?h:u;if(f&&m===0){let[b]=o.splitText(m,_);b.remove()}else{let[,b]=o.splitText(m,_);b.remove()}}else{let f=vt(p);o.replace(f)}r=0}}}function RU(t){let e=t.getStyle(),n=FD(e);ef.set(e,n)}function Ry(t,e){(F(t)?t.isCollapsed():Q(t)||G(t))||By(280);let n=tf(F(t)?t.style:Q(t)?t.getStyle():t.getTextStyle()),o=Object.entries(e).reduce(((i,[s,a])=>(typeof a=="function"?i[s]=a(n[s],t):a===null?delete i[s]:i[s]=a,i)),{...n}),r=BD(o);F(t)||Q(t)?t.setStyle(r):t.setTextStyle(r),ef.set(r,o)}function PU(t,e){if(F(t)&&t.isCollapsed()){Ry(t,e);let n=t.anchor.getNode();G(n)&&n.isEmpty()&&Ry(n,e)}zD((n=>{Ry(n,e)}))}function zD(t){let e=$();if(!e)return;let n=new Map;if(F(e))for(let i of W1(e).getTextSlices())i&&n.set(i.caret.origin.getKey(),i.getSliceIndices());let o=e.getNodes();for(let i of o){if(!Q(i)||!i.canHaveFormat())continue;let[s,a]=(r=i,n.get(r.getKey())||[0,r.getTextContentSize()]);a!==s&&(ky(i)||s===0&&a===i.getTextContentSize()?t(i):t(i.splitText(s,a)[s===0?0:1]))}var r;F(e)&&e.anchor.type==="text"&&e.focus.type==="text"&&e.anchor.key===e.focus.key&&HD(e)}function HD(t){if(t.isBackward()){let{anchor:e,focus:n}=t,{key:o,offset:r,type:i}=e;e.set(n.key,n.offset,n.type),n.set(o,r,i)}}function KD(t,e){let n=t.getFormatType(),o=t.getIndent();n!==e.getFormatType()&&e.setFormat(n),o!==e.getIndent()&&e.setIndent(o)}function FU(t,e,n=KD){if(t===null)return;let o=t.getStartEndPoints(),r=new Map,i=null;if(o){let[s,a]=o;i=Yo(),i.anchor.set(s.key,s.offset,s.type),i.focus.set(a.key,a.offset,a.type);let l=Fy(s.getNode(),Fc),c=Fy(a.getNode(),Fc);G(l)&&r.set(l.getKey(),l),G(c)&&r.set(c.getKey(),c)}for(let s of t.getNodes())if(G(s)&&Fc(s))r.set(s.getKey(),s);else if(o===null){let a=Fy(s,Fc);G(a)&&r.set(a.getKey(),a)}for(let[s,a]of r){let l=e();n(a,l),a.replace(l,!0),i&&(s===i.anchor.key&&i.anchor.set(l.getKey(),i.anchor.offset,i.anchor.type),s===i.focus.key&&i.focus.set(l.getKey(),i.focus.offset,i.focus.type))}i&&t.is($())&>(i)}function PD(t){return t.getNode().isAttached()}function BU(t){let e=t;for(;e!==null&&!Rt(e);){let n=e.getLatest(),o=e.getParent();n.getChildrenSize()===0&&e.remove(!0),e=o}}function $U(t,e,n=null){let o=t.getStartEndPoints(),r=o?o[0]:null,i=t.getNodes(),s=i.length;if(r!==null&&(s===0||s===1&&r.type==="element"&&r.getNode().getChildrenSize()===0)){let c=r.type==="text"?r.getNode().getParentOrThrow():r.getNode(),d=c.getChildren(),u=e();return u.setFormat(c.getFormatType()),u.setIndent(c.getIndent()),d.forEach((p=>u.append(p))),n&&(u=n.append(u)),void c.replace(u)}let a=null,l=[];for(let c=0;c<s;c++){let d=i[c];Rt(d)?(Py(t,l,l.length,e,n),l=[],a=d):a===null||a!==null&&eD(d,a)?l.push(d):(Py(t,l,l.length,e,n),l=[d])}Py(t,l,l.length,e,n)}function Py(t,e,n,o,r=null){if(e.length===0)return;let i=e[0],s=new Map,a=[],l=G(i)?i:i.getParentOrThrow();l.isInline()&&(l=l.getParentOrThrow());let c=!1;for(;l!==null;){let h=l.getPreviousSibling();if(h!==null){l=h,c=!0;break}if(l=l.getParentOrThrow(),Rt(l))break}let d=new Set;for(let h=0;h<n;h++){let m=e[h];G(m)&&m.getChildrenSize()===0&&d.add(m.getKey())}let u=new Set;for(let h=0;h<n;h++){let m=e[h],_=m.getParent();if(_!==null&&_.isInline()&&(_=_.getParent()),_!==null&&Rc(m)&&!u.has(m.getKey())){let b=_.getKey();if(s.get(b)===void 0){let y=o();y.setFormat(_.getFormatType()),y.setIndent(_.getIndent()),a.push(y),s.set(b,y),_.getChildren().forEach((x=>{y.append(x),u.add(x.getKey()),G(x)&&x.getChildrenKeys().forEach((v=>u.add(v)))})),BU(_)}}else if(d.has(m.getKey())){G(m)||By(179);let b=o();b.setFormat(m.getFormatType()),b.setIndent(m.getIndent()),a.push(b),m.remove(!0)}}if(r!==null)for(let h=0;h<a.length;h++){let m=a[h];r.append(m)}let p=null;if(Rt(l))if(c)if(r!==null)l.insertAfter(r);else for(let h=a.length-1;h>=0;h--){let m=a[h];l.insertAfter(m)}else{let h=l.getFirstChild();if(G(h)&&(l=h),h===null)if(r)l.append(r);else for(let m=0;m<a.length;m++){let _=a[m];l.append(_),p=_}else if(r!==null)h.insertBefore(r);else for(let m=0;m<a.length;m++){let _=a[m];h.insertBefore(_),p=_}}else if(r)l.insertAfter(r);else for(let h=a.length-1;h>=0;h--){let m=a[h];l.insertAfter(m),p=m}let f=Ar();F(f)&&PD(f.anchor)&&PD(f.focus)?gt(f.clone()):p!==null?p.selectEnd():t.dirty=!0}function UD(t){let e=t.anchor.getNode(),n=qo(e)?e:e.getParentOrThrow(),o=_s().getElementByKey(n.getKey());if(o===null)return!1;let r=o.ownerDocument.defaultView;return r===null?!1:r.getComputedStyle(o).writingMode==="vertical-rl"}function zU(t,e){let n=UD(t)?!e:e,o=mi(t.focus,n?"previous":"next");if(Bp(o))return!1;for(let r of Lc(o)){if(bi(r))return!r.origin.isInline();if(!G(r.origin)){if(Mn(r.origin))return!0;break}}return!1}function jD(t,e,n,o){t.modify(e?"extend":"move",n,o)}function VD(t){let e=t.anchor.getNode();return(qo(e)?e:e.getParentOrThrow()).getDirection()==="rtl"}function HU(t,e,n){let o=VD(t),r;r=UD(t)||o?!n:n,jD(t,e,r,"character")}function KU(t,e,n){let o=tf(t.getStyle());return o!==null&&o[e]||n}function UU(t,e,n=""){let o=null,r=t.getNodes(),i=t.anchor,s=t.focus,a=t.isBackward(),l=a?s.offset:i.offset,c=a?s.getNode():i.getNode();if(F(t)&&t.isCollapsed()&&t.style!==""){let d=tf(t.style);if(d!==null&&e in d)return d[e]}for(let d=0;d<r.length;d++){let u=r[d];if((d===0||l!==0||!u.is(c))&&Q(u)){let p=KU(u,e,n);if(o===null)o=p;else if(o!==p){o="";break}}}return o===null?n:o}function Fy(t,e){let n=t;for(;n!==null&&n.getParent()!==null&&!e(n);)n=n.getParentOrThrow();return e(n)?n:null}var jU=$D;var mt=$y,WD=mt.$addNodeStyle,uee=mt.$cloneWithProperties,pee=mt.$copyBlockFormatIndent,fee=mt.$ensureForwardRangeSelection,hee=mt.$forEachSelectedTextNode,gee=mt.$getSelectionStyleValueForProperty,zy=mt.$isAtNodeEnd,GD=mt.$isParentElementRTL,mee=mt.$moveCaretSelection,Hy=mt.$moveCharacter,_ee=mt.$patchStyleText,bee=mt.$selectAll,nf=mt.$setBlocksType,Ky=mt.$shouldOverrideDefaultCharacterSelection,of=mt.$sliceSelectedTextNodeContent,yee=mt.$trimTextContentFromAnchor,xee=mt.$wrapNodes,vee=mt.createDOMRange,YD=mt.createRectsFromDOMRange,Cee=mt.getCSSFromStyleObject,Uy=mt.getStyleObjectFromCSS,Eee=mt.trimTextContentFromAnchor;var Gy={};Re(Gy,{$descendantsMatching:()=>D3,$dfs:()=>p3,$dfsIterator:()=>oO,$filter:()=>w3,$findMatchingParent:()=>aO,$firstToLastIterator:()=>O3,$getAdjacentCaret:()=>f3,$getAdjacentSiblingOrParentSiblingCaret:()=>zc,$getDepth:()=>iO,$getNearestBlockElementAncestorOrThrow:()=>b3,$getNearestNodeOfType:()=>_3,$getNextRightPreorderNode:()=>m3,$getNextSiblingOrParentSibling:()=>g3,$insertFirst:()=>T3,$insertNodeToNearestRoot:()=>v3,$insertNodeToNearestRootAtCaret:()=>lO,$isEditorIsNestedEditor:()=>k3,$lastToFirstIterator:()=>Wy,$restoreEditorState:()=>x3,$reverseDfs:()=>h3,$reverseDfsIterator:()=>sO,$splitNode:()=>sD,$unwrapAndFilterDescendants:()=>N3,$unwrapNode:()=>I3,$wrapNodeInElement:()=>C3,CAN_USE_BEFORE_INPUT:()=>t3,CAN_USE_DOM:()=>eO,IS_ANDROID:()=>n3,IS_ANDROID_CHROME:()=>o3,IS_APPLE:()=>r3,IS_APPLE_WEBKIT:()=>i3,IS_CHROME:()=>s3,IS_FIREFOX:()=>tO,IS_IOS:()=>a3,IS_SAFARI:()=>l3,addClassNamesToElement:()=>c3,calculateZoomLevel:()=>S3,isBlockDomNode:()=>ND,isHTMLAnchorElement:()=>OD,isHTMLElement:()=>vs,isInlineDomNode:()=>$c,isMimeType:()=>nO,makeStateWrapper:()=>M3,markSelection:()=>QD,mediaFileReader:()=>u3,mergeRegister:()=>XD,objectKlassEquals:()=>E3,positionNodeOnRange:()=>ZD,registerNestedElementResolver:()=>y3,removeClassNamesFromElement:()=>d3,selectionAlwaysOnDisplay:()=>e3});function sf(t,...e){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",t);for(let r of e)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var ko=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,VU=ko&&"documentMode"in document?document.documentMode:null,WU=ko&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),GU=ko&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),YU=!(!ko||!("InputEvent"in window)||VU)&&"getTargetRanges"in new window.InputEvent("input"),qU=ko&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),JU=ko&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,qD=ko&&/Android/.test(navigator.userAgent),Vy=ko&&/^(?=.*Chrome).*/i.test(navigator.userAgent),XU=ko&&qD&&Vy,ZU=ko&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!Vy;function JD(...t){let e=[];for(let n of t)if(n&&typeof n=="string")for(let[o]of n.matchAll(/\S+/g))e.push(o);return e}function XD(...t){return()=>{for(let e=t.length-1;e>=0;e--)t[e]();t.length=0}}function Zo(t){return`${t}px`}var QU={attributes:!0,characterData:!0,childList:!0,subtree:!0};function ZD(t,e,n){let o=null,r=null,i=null,s=[],a=document.createElement("div");function l(){o===null&&sf(182),r===null&&sf(183);let{left:u,top:p}=r.getBoundingClientRect(),f=YD(t,e);var h,m;a.isConnected||(m=a,(h=r).insertBefore(m,h.firstChild));let _=!1;for(let b=0;b<f.length;b++){let y=f[b],x=s[b]||document.createElement("div"),v=x.style;v.position!=="absolute"&&(v.position="absolute",_=!0);let E=Zo(y.left-u);v.left!==E&&(v.left=E,_=!0);let C=Zo(y.top-p);v.top!==C&&(x.style.top=C,_=!0);let k=Zo(y.width);v.width!==k&&(x.style.width=k,_=!0);let T=Zo(y.height);v.height!==T&&(x.style.height=T,_=!0),x.parentNode!==a&&(a.append(x),_=!0),s[b]=x}for(;s.length>f.length;)s.pop();_&&n(s)}function c(){r=null,o=null,i!==null&&i.disconnect(),i=null,a.remove();for(let u of s)u.remove();s=[]}a.style.position="relative";let d=t.registerRootListener((function u(){let p=t.getRootElement();if(p===null)return c();let f=p.parentElement;if(!vs(f))return c();c(),o=p,r=f,i=new MutationObserver((h=>{let m=t.getRootElement(),_=m&&m.parentElement;if(m!==o||_!==r)return u();for(let b of h)if(!a.contains(b.target))return l()})),i.observe(f,QU),l()}));return()=>{d(),c()}}function rf(t,e,n){if(t.type!=="text"&&G(e)){let o=e.getDOMSlot(n);return[o.element,o.getFirstChildOffset()+t.offset]}return[TD(n)||n,t.offset]}function QD(t,e){let n=null,o=null,r=null,i=null,s=null,a=null,l=()=>{};function c(d){d.read((()=>{let u=$();if(!F(u))return n=null,r=null,i=null,a=null,l(),void(l=()=>{});let{anchor:p,focus:f}=u,h=p.getNode(),m=h.getKey(),_=p.offset,b=f.getNode(),y=b.getKey(),x=f.offset,v=t.getElementByKey(m),E=t.getElementByKey(y),C=n===null||v!==o||_!==r||m!==n.getKey(),k=i===null||E!==s||x!==a||y!==i.getKey();if((C||k)&&v!==null&&E!==null){let T=(function(w,S,N,D,O,M,I){let L=(w._window?w._window.document:document).createRange();return M.isBefore(N)?(L.setStart(...rf(O,M,I)),L.setEnd(...rf(S,N,D))):(L.setStart(...rf(S,N,D)),L.setEnd(...rf(O,M,I))),L})(t,p,h,v,f,b,E);l(),l=ZD(t,T,(w=>{if(e===void 0)for(let S of w){let N=S.style;N.background!=="Highlight"&&(N.background="Highlight"),N.color!=="HighlightText"&&(N.color="HighlightText"),N.marginTop!==Zo(-1.5)&&(N.marginTop=Zo(-1.5)),N.paddingTop!==Zo(4)&&(N.paddingTop=Zo(4)),N.paddingBottom!==Zo(0)&&(N.paddingBottom=Zo(0))}else e(w)}))}n=h,o=v,r=_,i=b,s=E,a=x}))}return c(t.getEditorState()),XD(t.registerUpdateListener((({editorState:d})=>c(d))),(()=>{l()}))}function e3(t){let e=null,n=()=>{let o=getSelection(),r=o&&o.anchorNode,i=t.getRootElement();r!==null&&i!==null&&i.contains(r)?e!==null&&(e(),e=null):e===null&&(e=QD(t))};return document.addEventListener("selectionchange",n),()=>{e!==null&&e(),document.removeEventListener("selectionchange",n)}}var t3=YU,eO=ko,n3=qD,o3=XU,r3=WU,i3=ZU,s3=Vy,tO=GU,a3=JU,l3=qU;function c3(t,...e){let n=JD(...e);n.length>0&&t.classList.add(...n)}function d3(t,...e){let n=JD(...e);n.length>0&&t.classList.remove(...n)}function nO(t,e){for(let n of e)if(t.type.startsWith(n))return!0;return!1}function u3(t,e){let n=t[Symbol.iterator]();return new Promise(((o,r)=>{let i=[],s=()=>{let{done:a,value:l}=n.next();if(a)return o(i);let c=new FileReader;c.addEventListener("error",r),c.addEventListener("load",(()=>{let d=c.result;typeof d=="string"&&i.push({file:l,result:d}),s()})),nO(l,e)?c.readAsDataURL(l):s()};s()}))}function p3(t,e){return Array.from(oO(t,e))}function f3(t){return t?t.getAdjacentCaret():null}function h3(t,e){return Array.from(sO(t,e))}function oO(t,e){return rO("next",t,e)}function rO(t,e,n){let o=Qe(),r=e||o,i=G(r)?qn(r,t):xn(r,t),s=iO(r),a=n?ms(Sy(xn(n,t))):(function(c,d){let u=zc(xn(c,d));return u&&u[0]})(r,t),l=s;return Ay({hasNext:c=>c!==null,initial:i,map:c=>({depth:l,node:c.origin}),step:c=>{if(c.isSameNodeCaret(a))return null;bi(c)&&l++;let d=zc(c);return!d||d[0].isSameNodeCaret(a)?null:(l+=d[1],d[0])}})}function g3(t){let e=zc(xn(t,"next"));return e&&[e[0].origin,e[1]]}function iO(t){let e=-1;for(let n=t;n!==null;n=n.getParent())e++;return e}function m3(t){let e=zc(Sy(xn(t,"previous")),"root");return e&&e[0].origin}function sO(t,e){return rO("previous",t,e)}function _3(t,e){let n=t;for(;n!=null;){if(n instanceof e)return n;n=n.getParent()}return null}function b3(t){let e=aO(t,(n=>G(n)&&!n.isInline()));return G(e)||sf(4,t.__key),e}var aO=(t,e)=>{let n=t;for(;n!==Qe()&&n!=null;){if(e(n))return n;n=n.getParent()}return null};function y3(t,e,n,o){let r=i=>i instanceof e;return t.registerNodeTransform(e,(i=>{let s=(a=>{let l=a.getChildren();for(let u=0;u<l.length;u++){let p=l[u];if(r(p))return null}let c=a,d=a;for(;c!==null;)if(d=c,c=c.getParent(),r(c))return{child:d,parent:c};return null})(i);if(s!==null){let{child:a,parent:l}=s;if(a.is(i)){o(l,i);let c=a.getNextSiblings(),d=c.length;if(l.insertAfter(a),d!==0){let u=n(l);a.insertAfter(u);for(let p=0;p<d;p++)u.append(c[p])}l.canBeEmpty()||l.getChildrenSize()!==0||l.remove()}}}))}function x3(t,e){let n=new Map,o=t._pendingEditorState;for(let[i,s]of e._nodeMap)n.set(i,_i(s));o&&(o._nodeMap=n),t._dirtyType=2;let r=e._selection;gt(r===null?null:r.clone())}function v3(t){let e=$()||Ar(),n;if(F(e))n=mi(e.focus,"next");else{if(e!=null){let s=e.getNodes(),a=s[s.length-1];a&&(n=xn(a,"next"))}n=n||qn(Qe(),"previous").getFlipped().insert(fe())}let o=lO(t,n),r=ms(o),i=bi(r)?Jo(r):o;return Kp(X1(i)),t.getLatest()}function lO(t,e,n){let o=Ty(e,"next");for(let r=o;r;r=iD(r,n))o=r;return zp(o)&&sf(283),o.insert(t.isInline()?fe().append(t):t),Ty(xn(t.getLatest(),"next"),e.direction)}function C3(t,e){let n=e();return t.replace(n),n.append(t),n}function E3(t,e){return t!==null&&Object.getPrototypeOf(t).constructor.name===e.name}function w3(t,e){let n=[];for(let o=0;o<t.length;o++){let r=e(t[o]);r!==null&&n.push(r)}return n}function T3(t,e){qn(t,"next").insert(e)}var jy=!(tO||!eO)&&void 0;function S3(t){let e=1;if((function(){if(jy===void 0){let n=document.createElement("div");n.style.cssText="position: absolute; opacity: 0; width: 100px; left: -1000px;",document.body.appendChild(n);let o=n.getBoundingClientRect();n.style.setProperty("zoom","2"),jy=n.getBoundingClientRect().width===o.width,document.body.removeChild(n)}return jy})())for(;t;)e*=Number(window.getComputedStyle(t).getPropertyValue("zoom")),t=t.parentElement;return e}function k3(t){return t._parentEditor!==null}function N3(t,e){return cO(t,e,null)}function cO(t,e,n){let o=!1;for(let r of Wy(t))e(r)?n!==null&&n(r):(o=!0,G(r)&&cO(r,e,n||(i=>r.insertAfter(i))),r.remove());return o}function D3(t,e){let n=[],o=Array.from(t).reverse();for(let r=o.pop();r!==void 0;r=o.pop())if(e(r))n.push(r);else if(G(r))for(let i of Wy(r))o.push(i);return n}function O3(t){return dO(qn(t,"next"))}function Wy(t){return dO(qn(t,"previous"))}function dO(t){return Ay({hasNext:$p,initial:t.getAdjacentCaret(),map:e=>e.origin.getLatest(),step:e=>e.getAdjacentCaret()})}function I3(t){oD(xn(t,"next")).splice(1,t.getChildren())}function zc(t,e="root"){let n=0,o=t,r=ms(o);for(;r===null;){if(n--,r=o.getParentCaret(e),!r)return null;o=r,r=ms(o)}return r&&[r,n]}function M3(t){let e=o=>Z1(o,t),n=(o,r)=>rD(o,t,r);return{$get:e,$set:n,accessors:[e,n],makeGetterMethod:()=>function(){return e(this)},makeSetterMethod:()=>function(o){return n(this,o)},stateConfig:t}}var he=Gy,Yy=he.$descendantsMatching,uO=he.$dfs,Nee=he.$dfsIterator,pO=he.$filter,le=he.$findMatchingParent,Dee=he.$firstToLastIterator,fO=he.$getAdjacentCaret,Oee=he.$getAdjacentSiblingOrParentSiblingCaret,Iee=he.$getDepth,Cs=he.$getNearestBlockElementAncestorOrThrow,af=he.$getNearestNodeOfType,Mee=he.$getNextRightPreorderNode,Aee=he.$getNextSiblingOrParentSibling,hO=he.$insertFirst,lf=he.$insertNodeToNearestRoot,Lee=he.$insertNodeToNearestRootAtCaret,gO=he.$isEditorIsNestedEditor,Ree=he.$lastToFirstIterator,Pee=he.$restoreEditorState,Fee=he.$reverseDfs,Bee=he.$reverseDfsIterator,$ee=he.$splitNode,qy=he.$unwrapAndFilterDescendants,zee=he.$unwrapNode,Hee=he.$wrapNodeInElement,Kee=he.CAN_USE_BEFORE_INPUT,Uee=he.CAN_USE_DOM,jee=he.IS_ANDROID,Vee=he.IS_ANDROID_CHROME,Et=he.IS_APPLE,Wee=he.IS_APPLE_WEBKIT,Gee=he.IS_CHROME,Yee=he.IS_FIREFOX,qee=he.IS_IOS,Jee=he.IS_SAFARI,Ve=he.addClassNamesToElement,mO=he.calculateZoomLevel,Jy=he.isBlockDomNode,Xy=he.isHTMLAnchorElement,Jt=he.isHTMLElement,Xee=he.isInlineDomNode,Zee=he.isMimeType,Qee=he.makeStateWrapper,ete=he.markSelection,tte=he.mediaFileReader,Be=he.mergeRegister,Xn=he.objectKlassEquals,nte=he.positionNodeOnRange,ote=he.registerNestedElementResolver,Fn=he.removeClassNamesFromElement,rte=he.selectionAlwaysOnDisplay;var ex={};Re(ex,{$createAutoLinkNode:()=>Zy,$createLinkNode:()=>Xa,$isAutoLinkNode:()=>Hc,$isLinkNode:()=>Si,$toggleLink:()=>yO,AutoLinkNode:()=>Kc,LinkNode:()=>Ja,TOGGLE_LINK_COMMAND:()=>R3,formatUrl:()=>Qy,toggleLink:()=>P3});var A3=new Set(["http:","https:","mailto:","sms:","tel:"]),Ja=class t extends Pt{static getType(){return"link"}static clone(e){return new t(e.__url,{rel:e.__rel,target:e.__target,title:e.__title},e.__key)}constructor(e="",n={},o){super(o);let{target:r=null,rel:i=null,title:s=null}=n;this.__url=e,this.__target=r,this.__rel=i,this.__title=s}createDOM(e){let n=document.createElement("a");return this.updateLinkDOM(null,n,e),Ve(n,e.theme.link),n}updateLinkDOM(e,n,o){if(Xy(n)){e&&e.__url===this.__url||(n.href=this.sanitizeUrl(this.__url));for(let r of["target","rel","title"]){let i=`__${r}`,s=this[i];e&&e[i]===s||(s?n[r]=s:n.removeAttribute(r))}}}updateDOM(e,n,o){return this.updateLinkDOM(e,n,o),!1}static importDOM(){return{a:e=>({conversion:L3,priority:1})}}static importJSON(e){return Xa().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setURL(e.url).setRel(e.rel||null).setTarget(e.target||null).setTitle(e.title||null)}sanitizeUrl(e){e=Qy(e);try{let n=new URL(Qy(e));if(!A3.has(n.protocol))return"about:blank"}catch{return e}return e}exportJSON(){return{...super.exportJSON(),rel:this.getRel(),target:this.getTarget(),title:this.getTitle(),url:this.getURL()}}getURL(){return this.getLatest().__url}setURL(e){let n=this.getWritable();return n.__url=e,n}getTarget(){return this.getLatest().__target}setTarget(e){let n=this.getWritable();return n.__target=e,n}getRel(){return this.getLatest().__rel}setRel(e){let n=this.getWritable();return n.__rel=e,n}getTitle(){return this.getLatest().__title}setTitle(e){let n=this.getWritable();return n.__title=e,n}insertNewAfter(e,n=!0){let o=Xa(this.__url,{rel:this.__rel,target:this.__target,title:this.__title});return this.insertAfter(o,n),o}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(e,n,o){if(!F(n))return!1;let r=n.anchor.getNode(),i=n.focus.getNode();return this.isParentOf(r)&&this.isParentOf(i)&&n.getTextContent().length>0}isEmailURI(){return this.__url.startsWith("mailto:")}isWebSiteURI(){return this.__url.startsWith("https://")||this.__url.startsWith("http://")}};function L3(t){let e=null;if(Xy(t)){let n=t.textContent;(n!==null&&n!==""||t.children.length>0)&&(e=Xa(t.getAttribute("href")||"",{rel:t.getAttribute("rel"),target:t.getAttribute("target"),title:t.getAttribute("title")}))}return{node:e}}function Xa(t="",e){return Tt(new Ja(t,e))}function Si(t){return t instanceof Ja}var Kc=class t extends Ja{constructor(e="",n={},o){super(e,n,o),this.__isUnlinked=n.isUnlinked!==void 0&&n.isUnlinked!==null&&n.isUnlinked}static getType(){return"autolink"}static clone(e){return new t(e.__url,{isUnlinked:e.__isUnlinked,rel:e.__rel,target:e.__target,title:e.__title},e.__key)}getIsUnlinked(){return this.__isUnlinked}setIsUnlinked(e){let n=this.getWritable();return n.__isUnlinked=e,n}createDOM(e){return this.__isUnlinked?document.createElement("span"):super.createDOM(e)}updateDOM(e,n,o){return super.updateDOM(e,n,o)||e.__isUnlinked!==this.__isUnlinked}static importJSON(e){return Zy().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setIsUnlinked(e.isUnlinked||!1)}static importDOM(){return null}exportJSON(){return{...super.exportJSON(),isUnlinked:this.__isUnlinked}}insertNewAfter(e,n=!0){let o=this.getParentOrThrow().insertNewAfter(e,n);if(G(o)){let r=Zy(this.__url,{isUnlinked:this.__isUnlinked,rel:this.__rel,target:this.__target,title:this.__title});return o.append(r),r}return null}};function Zy(t="",e){return Tt(new Kc(t,e))}function Hc(t){return t instanceof Kc}var R3=Rn("TOGGLE_LINK_COMMAND");function _O(t,e){if(t.type==="element"){let n=t.getNode();return G(n)||(function(o,...r){let i=new URL("https://lexical.dev/docs/error"),s=new URLSearchParams;s.append("code",o);for(let a of r)s.append("v",a);throw i.search=s.toString(),Error(`Minified Lexical error #${o}; visit ${i.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)})(252),n.getChildren()[t.offset+e]||null}return null}function yO(t,e={}){let{target:n,title:o}=e,r=e.rel===void 0?"noreferrer":e.rel,i=$();if(i===null||!F(i)&&!ct(i))return;if(ct(i)){let c=i.getNodes();return c.length===0?void 0:void c.forEach((d=>{if(t===null){let u=le(d,(p=>!Hc(p)&&Si(p)));u&&(u.insertBefore(d),u.getChildren().length===0&&u.remove())}else{let u=le(d,(p=>!Hc(p)&&Si(p)));if(u)u.setURL(t),n!==void 0&&u.setTarget(n),r!==void 0&&u.setRel(r);else{let p=Xa(t,{rel:r,target:n});d.insertBefore(p),p.append(d)}}}))}let s=i.extract();if(t===null)return void s.forEach((c=>{let d=le(c,(u=>!Hc(u)&&Si(u)));if(d){let u=d.getChildren();for(let p=0;p<u.length;p++)d.insertBefore(u[p]);d.remove()}}));let a=new Set,l=c=>{a.has(c.getKey())||(a.add(c.getKey()),c.setURL(t),n!==void 0&&c.setTarget(n),r!==void 0&&c.setRel(r),o!==void 0&&c.setTitle(o))};if(s.length===1){let c=bO(s[0],Si);if(c!==null)return l(c)}(function(c){let d=$();if(!F(d))return c();let u=Lr(d),p=u.isBackward(),f=_O(u.anchor,p?-1:0),h=_O(u.focus,p?0:-1),m=c();if(f||h){let _=$();if(F(_)){let b=_.clone();if(f){let y=f.getParent();y&&b.anchor.set(y.getKey(),f.getIndexWithinParent()+(p?1:0),"element")}if(h){let y=h.getParent();y&&b.focus.set(y.getKey(),h.getIndexWithinParent()+(p?0:1),"element")}gt(Lr(b))}}})((()=>{let c=null;for(let d of s){if(!d.isAttached())continue;let u=bO(d,Si);if(u){l(u);continue}if(G(d)){if(!d.isInline())continue;if(Si(d)){if(!(Hc(d)||c!==null&&c.getParentOrThrow().isParentOf(d))){l(d),c=d;continue}for(let f of d.getChildren())d.insertBefore(f);d.remove();continue}}let p=d.getPreviousSibling();Si(p)&&p.is(c)?p.append(d):(c=Xa(t,{rel:r,target:n,title:o}),d.insertAfter(c),c.append(d))}}))}var P3=yO;function bO(t,e){let n=t;for(;n!==null&&n.getParent()!==null&&!e(n);)n=n.getParentOrThrow();return e(n)?n:null}var F3=/^\+?[0-9\s()-]{5,}$/;function Qy(t){return t.match(/^[a-z][a-z0-9+.-]*:/i)||t.match(/^[/#.]/)?t:t.includes("@")?`mailto:${t}`:F3.test(t)?`tel:${t}`:`https://${t}`}var Qo=ex,lte=Qo.$createAutoLinkNode,cf=Qo.$createLinkNode,Uc=Qo.$isAutoLinkNode,Je=Qo.$isLinkNode,df=Qo.$toggleLink,xO=Qo.AutoLinkNode,Za=Qo.LinkNode,Bn=Qo.TOGGLE_LINK_COMMAND,cte=Qo.formatUrl,dte=Qo.toggleLink;var ix={};Re(ix,{$createListItemNode:()=>Zn,$createListNode:()=>$n,$getListDepth:()=>uf,$handleListInsertParagraph:()=>IO,$insertList:()=>jc,$isListItemNode:()=>Oe,$isListNode:()=>Te,$removeList:()=>rx,INSERT_CHECK_LIST_COMMAND:()=>MO,INSERT_ORDERED_LIST_COMMAND:()=>PO,INSERT_UNORDERED_LIST_COMMAND:()=>RO,ListItemNode:()=>ws,ListNode:()=>Qa,REMOVE_LIST_COMMAND:()=>FO,UPDATE_LIST_START_COMMAND:()=>LO,insertList:()=>G3,registerCheckList:()=>j3,registerList:()=>V3,registerListStrictIndentTransform:()=>W3,removeList:()=>Y3});function ki(t,...e){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",t);for(let r of e)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function uf(t){let e=1,n=t.getParent();for(;n!=null;){if(Oe(n)){let o=n.getParent();if(Te(o)){e++,n=o.getParent();continue}ki(40)}return e}return e}function tx(t){let e=t.getParent();Te(e)||ki(40);let n=e;for(;n!==null;)n=n.getParent(),Te(n)&&(e=n);return e}function NO(t){let e=[],n=t.getChildren().filter(Oe);for(let o=0;o<n.length;o++){let r=n[o],i=r.getFirstChild();Te(i)?e=e.concat(NO(i)):e.push(r)}return e}function er(t){return Oe(t)&&Te(t.getFirstChild())}function vO(t){return Zn().append(t)}function DO(t,e){return Oe(t)&&(e.length===0||e.length===1&&t.is(e[0])&&t.getChildrenSize()===0)}function jc(t){let e=$();if(e!==null){let n=e.getNodes();if(F(e)){let r=e.getStartEndPoints();r===null&&ki(143);let[i]=r,s=i.getNode(),a=s.getParent();if(Rt(s)){let l=s.getFirstChild();if(l)n=l.selectStart().getNodes();else{let c=fe();s.append(c),n=c.select().getNodes()}}else if(DO(s,n)){let l=$n(t);if(Rt(a)){s.replace(l);let c=Zn();G(s)&&(c.setFormat(s.getFormatType()),c.setIndent(s.getIndent())),l.append(c)}else if(Oe(s)){let c=s.getParentOrThrow();Es(l,c.getChildren()),c.replace(l)}return}}let o=new Set;for(let r=0;r<n.length;r++){let i=n[r];if(G(i)&&i.isEmpty()&&!Oe(i)&&!o.has(i.getKey())){CO(i,t);continue}let s=Rc(i)?i.getParent():Oe(i)&&i.isEmpty()?i:null;for(;s!=null;){let a=s.getKey();if(Te(s)){if(!o.has(a)){let l=$n(t);Es(l,s.getChildren()),s.replace(l),o.add(a)}break}{let l=s.getParent();if(Rt(l)&&!o.has(a)){o.add(a),CO(s,t);break}s=l}}}}}function Es(t,e){t.splice(t.getChildrenSize(),0,e)}function CO(t,e){if(Te(t))return t;let n=t.getPreviousSibling(),o=t.getNextSibling(),r=Zn(),i;if(Es(r,t.getChildren()),Te(n)&&e===n.getListType())n.append(r),Te(o)&&e===o.getListType()&&(Es(n,o.getChildren()),o.remove()),i=n;else if(Te(o)&&e===o.getListType())o.getFirstChildOrThrow().insertBefore(r),i=o;else{let s=$n(e);s.append(r),t.replace(s),i=s}return r.setFormat(t.getFormatType()),r.setIndent(t.getIndent()),t.remove(),i}function ox(t,e){let n=t.getLastChild(),o=e.getFirstChild();n&&o&&er(n)&&er(o)&&(ox(n.getFirstChild(),o.getFirstChild()),o.remove());let r=e.getChildren();r.length>0&&t.append(...r),e.remove()}function rx(){let t=$();if(F(t)){let e=new Set,n=t.getNodes(),o=t.anchor.getNode();if(DO(o,n))e.add(tx(o));else for(let r=0;r<n.length;r++){let i=n[r];if(Rc(i)){let s=af(i,ws);s!=null&&e.add(tx(s))}}for(let r of e){let i=r,s=NO(r);for(let a of s){let l=fe().setTextStyle(t.style).setTextFormat(t.format);Es(l,a.getChildren()),i.insertAfter(l),i=l,a.__key===t.anchor.key&&yi(t.anchor,Jo(qn(l,"next"))),a.__key===t.focus.key&&yi(t.focus,Jo(qn(l,"next"))),a.remove()}r.remove()}}}function OO(t){let e=t.getListType()!=="check",n=t.getStart();for(let o of t.getChildren())Oe(o)&&(o.getValue()!==n&&o.setValue(n),e&&o.getLatest().__checked!=null&&o.setChecked(void 0),Te(o.getFirstChild())||n++)}function B3(t){let e=new Set;if(er(t)||e.has(t.getKey()))return;let n=t.getParent(),o=t.getNextSibling(),r=t.getPreviousSibling();if(er(o)&&er(r)){let i=r.getFirstChild();if(Te(i)){i.append(t);let s=o.getFirstChild();Te(s)&&(Es(i,s.getChildren()),o.remove(),e.add(o.getKey()))}}else if(er(o)){let i=o.getFirstChild();if(Te(i)){let s=i.getFirstChild();s!==null&&s.insertBefore(t)}}else if(er(r)){let i=r.getFirstChild();Te(i)&&i.append(t)}else if(Te(n)){let i=Zn().setTextFormat(t.getTextFormat()).setTextStyle(t.getTextStyle()),s=$n(n.getListType()).setTextFormat(n.getTextFormat()).setTextStyle(n.getTextStyle());i.append(s),s.append(t),r?r.insertAfter(i):o?o.insertBefore(i):n.append(i)}}function $3(t){if(er(t))return;let e=t.getParent(),n=e?e.getParent():void 0;if(Te(n?n.getParent():void 0)&&Oe(n)&&Te(e)){let o=e?e.getFirstChild():void 0,r=e?e.getLastChild():void 0;if(t.is(o))n.insertBefore(t),e.isEmpty()&&n.remove();else if(t.is(r))n.insertAfter(t),e.isEmpty()&&n.remove();else{let i=e.getListType(),s=Zn(),a=$n(i);s.append(a),t.getPreviousSiblings().forEach((d=>a.append(d)));let l=Zn(),c=$n(i);l.append(c),Es(c,t.getNextSiblings()),n.insertBefore(s),n.insertAfter(l),n.replace(t)}}}function IO(){let t=$();if(!F(t)||!t.isCollapsed())return!1;let e=t.anchor.getNode();if(!Oe(e)||e.getChildrenSize()!==0)return!1;let n=tx(e),o=e.getParent();Te(o)||ki(40);let r=o.getParent(),i;if(Rt(r))i=fe(),n.insertAfter(i);else{if(!Oe(r))return!1;i=Zn(),r.insertAfter(i)}i.setTextStyle(t.style).setTextFormat(t.format).select();let s=e.getNextSiblings();if(s.length>0){let a=$n(o.getListType());if(Oe(i)){let l=Zn();l.append(a),i.insertAfter(l)}else i.insertAfter(a);a.append(...s)}return(function(a){let l=a;for(;l.getNextSibling()==null&&l.getPreviousSibling()==null;){let c=l.getParent();if(c==null||!Oe(c)&&!Te(c))break;l=c}l.remove()})(e),!0}function pf(...t){let e=[];for(let n of t)if(n&&typeof n=="string")for(let[o]of n.matchAll(/\S+/g))e.push(o);return e}var ws=class extends Pt{$config(){return this.config("listitem",{$transform:e=>{if(e.__checked==null)return;let n=e.getParent();Te(n)&&n.getListType()!=="check"&&e.getChecked()!=null&&e.setChecked(void 0)},extends:Pt,importDOM:Iy({li:()=>({conversion:z3,priority:0})})})}constructor(e=1,n=void 0,o){super(o),this.__value=e===void 0?1:e,this.__checked=n}afterCloneFrom(e){super.afterCloneFrom(e),this.__value=e.__value,this.__checked=e.__checked}createDOM(e){let n=document.createElement("li");return this.updateListItemDOM(null,n,e),n}updateListItemDOM(e,n,o){let r=this.getParent();Te(r)&&r.getListType()==="check"&&(function(a,l,c,d){Te(l.getFirstChild())?(a.removeAttribute("role"),a.removeAttribute("tabIndex"),a.removeAttribute("aria-checked")):(a.setAttribute("role","checkbox"),a.setAttribute("tabIndex","-1"),c&&l.__checked===c.__checked||a.setAttribute("aria-checked",l.getChecked()?"true":"false"))})(n,this,e),n.value=this.__value,(function(a,l,c){let d=[],u=[],p=l.list,f=p?p.listitem:void 0,h;if(p&&p.nested&&(h=p.nested.listitem),f!==void 0&&d.push(...pf(f)),p){let m=c.getParent(),_=Te(m)&&m.getListType()==="check",b=c.getChecked();_&&!b||u.push(p.listitemUnchecked),_&&b||u.push(p.listitemChecked),_&&d.push(b?p.listitemChecked:p.listitemUnchecked)}if(h!==void 0){let m=pf(h);c.getChildren().some((_=>Te(_)))?d.push(...m):u.push(...m)}u.length>0&&Fn(a,...u),d.length>0&&Ve(a,...d)})(n,o.theme,this);let i=e?e.__style:"",s=this.__style;i!==s&&(s===""?n.removeAttribute("style"):n.style.cssText=s),(function(a,l,c){let d=Uy(l.__textStyle);for(let u in d)a.style.setProperty(`--listitem-marker-${u}`,d[u]);if(c)for(let u in Uy(c.__textStyle))u in d||a.style.removeProperty(`--listitem-marker-${u}`)})(n,this,e)}updateDOM(e,n,o){let r=n;return this.updateListItemDOM(e,r,o),!1}updateFromJSON(e){return super.updateFromJSON(e).setValue(e.value).setChecked(e.checked)}exportDOM(e){let n=this.createDOM(e._config),o=this.getFormatType();o&&(n.style.textAlign=o);let r=this.getDirection();return r&&(n.dir=r),{element:n}}exportJSON(){return{...super.exportJSON(),checked:this.getChecked(),value:this.getValue()}}append(...e){for(let n=0;n<e.length;n++){let o=e[n];if(G(o)&&this.canMergeWith(o)){let r=o.getChildren();this.append(...r),o.remove()}else super.append(o)}return this}replace(e,n){if(Oe(e))return super.replace(e);this.setIndent(0);let o=this.getParentOrThrow();if(!Te(o))return e;if(o.__first===this.getKey())o.insertBefore(e);else if(o.__last===this.getKey())o.insertAfter(e);else{let r=$n(o.getListType()),i=this.getNextSibling();for(;i;){let s=i;i=i.getNextSibling(),r.append(s)}o.insertAfter(e),e.insertAfter(r)}return n&&(G(e)||ki(139),this.getChildren().forEach((r=>{e.append(r)}))),this.remove(),o.getChildrenSize()===0&&o.remove(),e}insertAfter(e,n=!0){let o=this.getParentOrThrow();if(Te(o)||ki(39),Oe(e))return super.insertAfter(e,n);let r=this.getNextSiblings();if(o.insertAfter(e,n),r.length!==0){let i=$n(o.getListType());r.forEach((s=>i.append(s))),e.insertAfter(i,n)}return e}remove(e){let n=this.getPreviousSibling(),o=this.getNextSibling();super.remove(e),n&&o&&er(n)&&er(o)&&(ox(n.getFirstChild(),o.getFirstChild()),o.remove())}insertNewAfter(e,n=!0){let o=Zn().updateFromJSON(this.exportJSON()).setChecked(!this.getChecked()&&void 0);return this.insertAfter(o,n),o}collapseAtStart(e){let n=fe();this.getChildren().forEach((s=>n.append(s)));let o=this.getParentOrThrow(),r=o.getParentOrThrow(),i=Oe(r);if(o.getChildrenSize()===1)if(i)o.remove(),r.select();else{o.insertBefore(n),o.remove();let s=e.anchor,a=e.focus,l=n.getKey();s.type==="element"&&s.getNode().is(this)&&s.set(l,s.offset,"element"),a.type==="element"&&a.getNode().is(this)&&a.set(l,a.offset,"element")}else o.insertBefore(n),this.remove();return!0}getValue(){return this.getLatest().__value}setValue(e){let n=this.getWritable();return n.__value=e,n}getChecked(){let e=this.getLatest(),n,o=this.getParent();return Te(o)&&(n=o.getListType()),n==="check"?!!e.__checked:void 0}setChecked(e){let n=this.getWritable();return n.__checked=e,n}toggleChecked(){let e=this.getWritable();return e.setChecked(!e.__checked)}getIndent(){let e=this.getParent();if(e===null||!this.isAttached())return this.getLatest().__indent;let n=e.getParentOrThrow(),o=0;for(;Oe(n);)n=n.getParentOrThrow().getParentOrThrow(),o++;return o}setIndent(e){typeof e!="number"&&ki(117),(e=Math.floor(e))>=0||ki(199);let n=this.getIndent();for(;n!==e;)n<e?(B3(this),n++):($3(this),n--);return this}canInsertAfter(e){return Oe(e)}canReplaceWith(e){return Oe(e)}canMergeWith(e){return Oe(e)||qt(e)}extractWithChild(e,n){if(!F(n))return!1;let o=n.anchor.getNode(),r=n.focus.getNode();return this.isParentOf(o)&&this.isParentOf(r)&&this.getTextContent().length===n.getTextContent().length}isParentRequired(){return!0}createParentElementNode(){return $n("bullet")}canMergeWhenEmpty(){return!0}};function z3(t){if(t.classList.contains("task-list-item")){for(let n of t.children)if(n.tagName==="INPUT")return H3(n)}let e=t.getAttribute("aria-checked");return{node:Zn(e==="true"||e!=="false"&&void 0)}}function H3(t){return t.getAttribute("type")!=="checkbox"?{node:null}:{node:Zn(t.hasAttribute("checked"))}}function Zn(t){return Tt(new ws(void 0,t))}function Oe(t){return t instanceof ws}var Qa=class extends Pt{$config(){return this.config("list",{$transform:e=>{(function(n){let o=n.getNextSibling();Te(o)&&n.getListType()===o.getListType()&&ox(n,o)})(e),OO(e)},extends:Pt,importDOM:Iy({ol:()=>({conversion:wO,priority:0}),ul:()=>({conversion:wO,priority:0})})})}constructor(e="number",n=1,o){super(o);let r=U3[e]||e;this.__listType=r,this.__tag=r==="number"?"ol":"ul",this.__start=n}afterCloneFrom(e){super.afterCloneFrom(e),this.__listType=e.__listType,this.__tag=e.__tag,this.__start=e.__start}getTag(){return this.getLatest().__tag}setListType(e){let n=this.getWritable();return n.__listType=e,n.__tag=e==="number"?"ol":"ul",n}getListType(){return this.getLatest().__listType}getStart(){return this.getLatest().__start}setStart(e){let n=this.getWritable();return n.__start=e,n}createDOM(e,n){let o=this.__tag,r=document.createElement(o);return this.__start!==1&&r.setAttribute("start",String(this.__start)),r.__lexicalListType=this.__listType,EO(r,e.theme,this),r}updateDOM(e,n,o){return e.__tag!==this.__tag||(EO(n,o.theme,this),!1)}updateFromJSON(e){return super.updateFromJSON(e).setListType(e.listType).setStart(e.start)}exportDOM(e){let n=this.createDOM(e._config,e);return Jt(n)&&(this.__start!==1&&n.setAttribute("start",String(this.__start)),this.__listType==="check"&&n.setAttribute("__lexicalListType","check")),{element:n}}exportJSON(){return{...super.exportJSON(),listType:this.getListType(),start:this.getStart(),tag:this.getTag()}}canBeEmpty(){return!1}canIndent(){return!1}splice(e,n,o){let r=o;for(let i=0;i<o.length;i++){let s=o[i];Oe(s)||(r===o&&(r=[...o]),r[i]=Zn().append(!G(s)||Te(s)||s.isInline()?s:vt(s.getTextContent())))}return super.splice(e,n,r)}extractWithChild(e){return Oe(e)}};function EO(t,e,n){let o=[],r=[],i=e.list;if(i!==void 0){let s=i[`${n.__tag}Depth`]||[],a=uf(n)-1,l=a%s.length,c=s[l],d=i[n.__tag],u,p=i.nested,f=i.checklist;if(p!==void 0&&p.list&&(u=p.list),d!==void 0&&o.push(d),f!==void 0&&n.__listType==="check"&&o.push(f),c!==void 0){o.push(...pf(c));for(let h=0;h<s.length;h++)h!==l&&r.push(n.__tag+h)}if(u!==void 0){let h=pf(u);a>1?o.push(...h):r.push(...h)}}r.length>0&&Fn(t,...r),o.length>0&&Ve(t,...o)}function K3(t){let e=[];for(let n=0;n<t.length;n++){let o=t[n];if(Oe(o)){e.push(o);let r=o.getChildren();r.length>1&&r.forEach((i=>{Te(i)&&e.push(vO(i))}))}else e.push(vO(o))}return e}function wO(t){let e=t.nodeName.toLowerCase(),n=null;return e==="ol"?n=$n("number",t.start):e==="ul"&&(n=(function(o){if(o.getAttribute("__lexicallisttype")==="check"||o.classList.contains("contains-task-list"))return!0;for(let r of o.childNodes)if(Jt(r)&&r.hasAttribute("aria-checked"))return!0;return!1})(t)?$n("check"):$n("bullet")),{after:K3,node:n}}var U3={ol:"number",ul:"bullet"};function $n(t="number",e=1){return Tt(new Qa(t,e))}function Te(t){return t instanceof Qa}var MO=Rn("INSERT_CHECK_LIST_COMMAND");function j3(t){return Be(t.registerCommand(MO,(()=>(jc("check"),!0)),Ae),t.registerCommand(Rr,(e=>kO(e,t,!1)),Ae),t.registerCommand(So,(e=>kO(e,t,!0)),Ae),t.registerCommand(Ci,(()=>{if(nx()!=null){let e=t.getRootElement();return e?.focus(),!0}return!1}),Ae),t.registerCommand(Zp,(e=>{let n=nx();return!(n==null||!t.isEditable())&&(t.update((()=>{let o=on(n);Oe(o)&&(e.preventDefault(),o.toggleChecked())})),!0)}),Ae),t.registerCommand(qa,(e=>t.getEditorState().read((()=>{let n=$();if(F(n)&&n.isCollapsed()){let{anchor:o}=n,r=o.type==="element";if(r||o.offset===0){let i=o.getNode(),s=le(i,(a=>G(a)&&!a.isInline()));if(Oe(s)){let a=s.getParent();if(Te(a)&&a.getListType()==="check"&&(r||s.getFirstDescendant()===i)){let l=t.getElementByKey(s.__key);if(l!=null&&document.activeElement!==l)return l.focus(),e.preventDefault(),!0}}}}return!1}))),Ae),t.registerRootListener(((e,n)=>{e!==null&&(e.addEventListener("click",TO),e.addEventListener("pointerdown",SO)),n!==null&&(n.removeEventListener("click",TO),n.removeEventListener("pointerdown",SO))})))}function AO(t,e){let n=t.target;if(!Jt(n))return;let o=n.firstChild;if(Jt(o)&&(o.tagName==="UL"||o.tagName==="OL"))return;let r=n.parentNode;if(!r||r.__lexicalListType!=="check")return;let i=n.getBoundingClientRect(),s=mO(n),a=t.clientX/s,l=window.getComputedStyle?window.getComputedStyle(n,"::before"):{width:"0px"},c=parseFloat(l.width),d=t.pointerType==="touch"?32:0;(n.dir==="rtl"?a<i.right+d&&a>i.right-c-d:a>i.left-d&&a<i.left+c+d)&&e()}function TO(t){AO(t,(()=>{if(Jt(t.target)){let e=t.target,n=SD(e);n!=null&&n.isEditable()&&n.update((()=>{let o=on(e);Oe(o)&&(e.focus(),o.toggleChecked())}))}}))}function SO(t){AO(t,(()=>{t.preventDefault()}))}function nx(){let t=document.activeElement;return Jt(t)&&t.tagName==="LI"&&t.parentNode!=null&&t.parentNode.__lexicalListType==="check"?t:null}function kO(t,e,n){let o=nx();return o!=null&&e.update((()=>{let r=on(o);if(!Oe(r))return;let i=(function(s,a){let l=a?s.getPreviousSibling():s.getNextSibling(),c=s;for(;l==null&&Oe(c);)c=c.getParentOrThrow().getParent(),c!=null&&(l=a?c.getPreviousSibling():c.getNextSibling());for(;Oe(l);){let d=a?l.getLastChild():l.getFirstChild();if(!Te(d))return l;l=a?d.getLastChild():d.getFirstChild()}return null})(r,n);if(i!=null){i.selectStart();let s=e.getElementByKey(i.__key);s!=null&&(t.preventDefault(),setTimeout((()=>{s.focus()}),0))}})),!1}var LO=Rn("UPDATE_LIST_START_COMMAND"),RO=Rn("INSERT_UNORDERED_LIST_COMMAND"),PO=Rn("INSERT_ORDERED_LIST_COMMAND"),FO=Rn("REMOVE_LIST_COMMAND");function V3(t){return Be(t.registerCommand(PO,(()=>(jc("number"),!0)),Ae),t.registerCommand(LO,(e=>{let{listNodeKey:n,newStart:o}=e,r=St(n);return!!Te(r)&&(r.getListType()==="number"&&(r.setStart(o),OO(r)),!0)}),Ae),t.registerCommand(RO,(()=>(jc("bullet"),!0)),Ae),t.registerCommand(FO,(()=>(rx(),!0)),Ae),t.registerCommand(vi,(()=>IO()),Ae),t.registerNodeTransform(ws,(e=>{let n=e.getFirstChild();if(n){if(Q(n)){let o=n.getStyle(),r=n.getFormat();e.getTextStyle()!==o&&e.setTextStyle(o),e.getTextFormat()!==r&&e.setTextFormat(r)}}else{let o=$();F(o)&&(o.style!==e.getTextStyle()||o.format!==e.getTextFormat())&&o.isCollapsed()&&e.is(o.anchor.getNode())&&e.setTextStyle(o.style).setTextFormat(o.format)}})),t.registerNodeTransform(Ft,(e=>{let n=e.getParent();if(Oe(n)&&e.is(n.getFirstChild())){let o=e.getStyle(),r=e.getFormat();o===n.getTextStyle()&&r===n.getTextFormat()||n.setTextStyle(o).setTextFormat(r)}})))}function W3(t){let e=n=>{let o=n.getParent();if(Te(n.getFirstChild())||!Te(o))return;let r=le(n,(i=>Oe(i)&&Te(i.getParent())&&Oe(i.getPreviousSibling())));if(r===null&&n.getIndent()>0)n.setIndent(0);else if(Oe(r)){let i=r.getPreviousSibling();if(Oe(i)){let s=(function(l){let c=l,d=c.getFirstChild();for(;Te(d);){let u=d.getLastChild();if(!Oe(u))break;c=u,d=c.getFirstChild()}return c})(i),a=s.getParent();if(Te(a)){let l=uf(a);l+1<uf(o)&&n.setIndent(l)}}}};return t.registerNodeTransform(Qa,(n=>{let o=[n];for(;o.length>0;){let r=o.shift();if(Te(r)){for(let i of r.getChildren())if(Oe(i)){e(i);let s=i.getFirstChild();Te(s)&&o.push(s)}}}}))}function G3(t,e){t.update((()=>jc(e)))}function Y3(t){t.update((()=>rx()))}var kt=ix,Vc=kt.$createListItemNode,el=kt.$createListNode,gte=kt.$getListDepth,mte=kt.$handleListInsertParagraph,_te=kt.$insertList,Wc=kt.$isListItemNode,vn=kt.$isListNode,bte=kt.$removeList,yte=kt.INSERT_CHECK_LIST_COMMAND,BO=kt.INSERT_ORDERED_LIST_COMMAND,$O=kt.INSERT_UNORDERED_LIST_COMMAND,Ni=kt.ListItemNode,tr=kt.ListNode,xte=kt.REMOVE_LIST_COMMAND,vte=kt.UPDATE_LIST_START_COMMAND,Cte=kt.insertList,Ete=kt.registerCheckList,zO=kt.registerList,HO=kt.registerListStrictIndentTransform,wte=kt.removeList;var sx={};Re(sx,{LexicalComposerContext:()=>KO,createLexicalComposerContext:()=>q3,useLexicalComposerContext:()=>J3});pt();var KO=Ot(null);function q3(t,e){let n=null;return t!=null&&(n=t[1]),{getTheme:function(){return e??(n!=null?n.getTheme():null)}}}function J3(){let t=It(KO);return t==null&&(function(e,...n){let o=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(let i of n)r.append("v",i);throw o.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${o.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)})(8),t}var ax=sx,UO=ax.LexicalComposerContext,jO=ax.createLexicalComposerContext,be=ax.useLexicalComposerContext;var lx={};Re(lx,{AutoFocusPlugin:()=>X3});pt();function X3({defaultSelection:t}){let[e]=be();return P((()=>{e.focus((()=>{let n=document.activeElement,o=e.getRootElement();o===null||n!==null&&o.contains(n)||o.focus({preventScroll:!0})}),{defaultSelection:t})}),[t,e]),null}var Z3=lx,VO=Z3.AutoFocusPlugin;var cx={};Re(cx,{LexicalComposer:()=>ej});pt();var WO=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,Q3=WO?un:P,ff={tag:Ya};function ej({initialConfig:t,children:e}){let n=J((()=>{let{theme:o,namespace:r,nodes:i,onError:s,editorState:a,html:l}=t,c=jO(null,o),d=wD({editable:t.editable,html:l,namespace:r,nodes:i,onError:u=>s(u,d),theme:o});return(function(u,p){if(p!==null){if(p===void 0)u.update((()=>{let f=Qe();if(f.isEmpty()){let h=fe();f.append(h);let m=WO?document.activeElement:null;($()!==null||m!==null&&m===u.getRootElement())&&h.select()}}),ff);else if(p!==null)switch(typeof p){case"string":{let f=u.parseEditorState(p);u.setEditorState(f,ff);break}case"object":u.setEditorState(p,ff);break;case"function":u.update((()=>{Qe().isEmpty()&&p(u)}),ff)}}})(d,a),[d,c]}),[]);return Q3((()=>{let o=t.editable,[r]=n;r.setEditable(o===void 0||o)}),[]),g(UO.Provider,{value:n,children:e})}var tj=cx,GO=tj.LexicalComposer;var ux={};Re(ux,{$canShowPlaceholder:()=>qO,$canShowPlaceholderCurry:()=>oj,$findTextIntersectionFromCharacters:()=>rj,$isRootTextContentEmpty:()=>dx,$isRootTextContentEmptyCurry:()=>nj,$rootTextContent:()=>YO,registerLexicalTextEntity:()=>sj});function YO(){return Qe().getTextContent()}function dx(t,e=!0){if(t)return!1;let n=YO();return e&&(n=n.trim()),n===""}function nj(t,e){return()=>dx(t,e)}function qO(t){if(!dx(t,!1))return!1;let e=Qe().getChildren(),n=e.length;if(n>1)return!1;for(let o=0;o<n;o++){let r=e[o];if(Mn(r))return!1;if(G(r)){if(!qt(r)||r.__indent!==0)return!1;let i=r.getChildren(),s=i.length;for(let a=0;a<s;a++){let l=i[o];if(!Q(l))return!1}}}return!0}function oj(t){return()=>qO(t)}function rj(t,e){let n=t.getFirstChild(),o=0;e:for(;n!==null;){if(G(n)){let s=n.getFirstChild();if(s!==null){n=s;continue}}else if(Q(n)){let s=n.getTextContentSize();if(o+s>e)return{node:n,offset:e-o};o+=s}let r=n.getNextSibling();if(r!==null){n=r;continue}let i=n.getParent();for(;i!==null;){let s=i.getNextSibling();if(s!==null){n=s;continue e}i=i.getParent()}break}return null}function ij(t,...e){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",t);for(let r of e)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function sj(t,e,n,o){let r=s=>s instanceof n,i=s=>{let a=vt(s.getTextContent());a.setFormat(s.getFormat()),s.replace(a)};return[t.registerNodeTransform(Ft,(s=>{if(!s.isSimpleText())return;let a,l=s.getPreviousSibling(),c=s.getTextContent(),d=s;if(Q(l)){let p=l.getTextContent(),f=e(p+c);if(r(l)){if(f===null||(h=>h.getLatest().__mode)(l)!==0)return void i(l);{let h=f.end-p.length;if(h>0){let m=p+c.slice(0,h);if(l.select(),l.setTextContent(m),h===c.length)s.remove();else{let _=c.slice(h);s.setTextContent(_)}return}}}else if(f===null||f.start<p.length)return}let u=0;for(;;){a=e(c);let p,f=a===null?"":c.slice(a.end);if(c=f,f===""){let m=d.getNextSibling();if(Q(m)){f=d.getTextContent()+m.getTextContent();let _=e(f);if(_===null)return void(r(m)?i(m):m.markDirty());if(_.start!==0)return}}if(a===null)return;if(a.start===0&&Q(l)&&l.isTextEntity()){u+=a.end;continue}a.start===0?[p,d]=d.splitText(a.end):[,p,d]=d.splitText(a.start+u,a.end+u),p===void 0&&ij(165,"nodeToReplace");let h=o(p);if(h.setFormat(p.getFormat()),p.replace(h),d==null)return;u=0,l=h}})),t.registerNodeTransform(n,(s=>{let a=s.getTextContent(),l=e(a);if(l===null||l.start!==0)return void i(s);if(a.length>l.end)return void s.splitText(l.end);let c=s.getPreviousSibling();Q(c)&&c.isTextEntity()&&(i(c),i(s));let d=s.getNextSibling();Q(d)&&d.isTextEntity()&&(i(d),r(s)&&i(s))}))]}var Ts=ux,$te=Ts.$canShowPlaceholder,hf=Ts.$canShowPlaceholderCurry,zte=Ts.$findTextIntersectionFromCharacters,Hte=Ts.$isRootTextContentEmpty,Kte=Ts.$isRootTextContentEmptyCurry,Ute=Ts.$rootTextContent,jte=Ts.registerLexicalTextEntity;var px={};Re(px,{ContentEditable:()=>lj,ContentEditableElement:()=>ZO});pt();var XO=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?un:P;function aj({editor:t,ariaActiveDescendant:e,ariaAutoComplete:n,ariaControls:o,ariaDescribedBy:r,ariaErrorMessage:i,ariaExpanded:s,ariaInvalid:a,ariaLabel:l,ariaLabelledBy:c,ariaMultiline:d,ariaOwns:u,ariaRequired:p,autoCapitalize:f,className:h,id:m,role:_="textbox",spellCheck:b=!0,style:y,tabIndex:x,"data-testid":v,...E},C){let[k,T]=R(t.isEditable()),w=we((N=>{N&&N.ownerDocument&&N.ownerDocument.defaultView?t.setRootElement(N):t.setRootElement(null)}),[t]),S=J((()=>(function(...N){return D=>{N.forEach((O=>{typeof O=="function"?O(D):O!=null&&(O.current=D)}))}})(C,w)),[w,C]);return XO((()=>(T(t.isEditable()),t.registerEditableListener((N=>{T(N)})))),[t]),g("div",{"aria-activedescendant":k?e:void 0,"aria-autocomplete":k?n:"none","aria-controls":k?o:void 0,"aria-describedby":r,...i!=null?{"aria-errormessage":i}:{},"aria-expanded":k&&_==="combobox"?!!s:void 0,...a!=null?{"aria-invalid":a}:{},"aria-label":l,"aria-labelledby":c,"aria-multiline":d,"aria-owns":k?u:void 0,"aria-readonly":!k||void 0,"aria-required":p,autoCapitalize:f,className:h,contentEditable:k,"data-testid":v,id:m,ref:S,role:_,spellCheck:b,style:y,tabIndex:x,...E})}var ZO=$i(aj);function JO(t){return t.getEditorState().read(hf(t.isComposing()))}var lj=$i(cj);function cj(t,e){let{placeholder:n,...o}=t,[r]=be();return g(Me,{children:[g(ZO,{editor:r,...o,ref:e}),n!=null&&g(dj,{editor:r,content:n})]})}function dj({content:t,editor:e}){let n=(function(s){let[a,l]=R((()=>JO(s)));return XO((()=>{function c(){let d=JO(s);l(d)}return c(),Be(s.registerUpdateListener((()=>{c()})),s.registerEditableListener((()=>{c()})))}),[s]),a})(e),[o,r]=R(e.isEditable());if(un((()=>(r(e.isEditable()),e.registerEditableListener((s=>{r(s)})))),[e]),!n)return null;let i=null;return typeof t=="function"?i=t(o):t!==null&&(i=t),i===null?null:g("div",{"aria-hidden":!0,children:i})}var QO=px,eI=QO.ContentEditable,Xte=QO.ContentEditableElement;var hx={};Re(hx,{LexicalErrorBoundary:()=>pj});pt();function fx(t,e){return fx=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},fx(t,e)}var tI={error:null},uj=(function(t){var e,n;function o(){for(var i,s=arguments.length,a=new Array(s),l=0;l<s;l++)a[l]=arguments[l];return(i=t.call.apply(t,[this].concat(a))||this).state=tI,i.resetErrorBoundary=function(){for(var c,d=arguments.length,u=new Array(d),p=0;p<d;p++)u[p]=arguments[p];i.props.onReset==null||(c=i.props).onReset.apply(c,u),i.reset()},i}n=t,(e=o).prototype=Object.create(n.prototype),e.prototype.constructor=e,fx(e,n),o.getDerivedStateFromError=function(i){return{error:i}};var r=o.prototype;return r.reset=function(){this.setState(tI)},r.componentDidCatch=function(i,s){var a,l;(a=(l=this.props).onError)==null||a.call(l,i,s)},r.componentDidUpdate=function(i,s){var a,l,c,d,u=this.state.error,p=this.props.resetKeys;u!==null&&s.error!==null&&((c=i.resetKeys)===void 0&&(c=[]),(d=p)===void 0&&(d=[]),c.length!==d.length||c.some((function(f,h){return!Object.is(f,d[h])})))&&((a=(l=this.props).onResetKeysChange)==null||a.call(l,i.resetKeys,p),this.reset())},r.render=function(){var i=this.state.error,s=this.props,a=s.fallbackRender,l=s.FallbackComponent,c=s.fallback;if(i!==null){var d={error:i,resetErrorBoundary:this.resetErrorBoundary};if(jv(c))return c;if(typeof a=="function")return a(d);if(l)return Bi(l,d);throw new Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop")}return this.props.children},o})(Bv);function pj({children:t,onError:e}){return g(uj,{fallback:g("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}),onError:e,children:t})}var fj=hx,nI=fj.LexicalErrorBoundary;var _x={};Re(_x,{createEmptyHistoryState:()=>xj,registerHistory:()=>yj});var gf=0,gx=1,mx=2,No=0,hj=1,oI=2,gj=3,mj=4;function _j(t,e,n,o,r){if(t===null||n.size===0&&o.size===0&&!r)return No;let i=e._selection,s=t._selection;if(r)return hj;if(!(F(i)&&F(s)&&s.isCollapsed()&&i.isCollapsed()))return No;let a=(function(b,y,x){let v=b._nodeMap,E=[];for(let C of y){let k=v.get(C);k!==void 0&&E.push(k)}for(let[C,k]of x){if(!k)continue;let T=v.get(C);T===void 0||qo(T)||E.push(T)}return E})(e,n,o);if(a.length===0)return No;if(a.length>1){let b=e._nodeMap,y=b.get(i.anchor.key),x=b.get(s.anchor.key);return y&&x&&!t._nodeMap.has(y.__key)&&Q(y)&&y.__text.length===1&&i.anchor.offset===1?oI:No}let l=a[0],c=t._nodeMap.get(l.__key);if(!Q(c)||!Q(l)||c.__mode!==l.__mode)return No;let d=c.__text,u=l.__text;if(d===u)return No;let p=i.anchor,f=s.anchor;if(p.key!==f.key||p.type!=="text")return No;let h=p.offset,m=f.offset,_=u.length-d.length;return _===1&&m===h-1?oI:_===-1&&m===h+1?gj:_===-1&&m===h?mj:No}function bj(t,e){let n=Date.now(),o=No;return(r,i,s,a,l,c)=>{let d=Date.now();if(c.has(Ga))return o=No,n=d,mx;let u=_j(r,i,a,l,t.isComposing()),p=(()=>{let f=s===null||s.editor===t,h=c.has(hD);if(!h&&f&&c.has(Ya))return gf;if(r===null)return gx;let m=i._selection;return a.size>0||l.size>0?h===!1&&u!==No&&u===o&&d<n+e&&f||a.size===1&&(function(_,b,y){let x=b._nodeMap.get(_),v=y._nodeMap.get(_),E=b._selection,C=y._selection;return!(F(E)&&F(C)&&E.anchor.type==="element"&&E.focus.type==="element"&&C.anchor.type==="text"&&C.focus.type==="text"||!Q(x)||!Q(v)||x.__parent!==v.__parent)&&JSON.stringify(b.read((()=>x.exportJSON())))===JSON.stringify(y.read((()=>v.exportJSON())))})(Array.from(a)[0],r,i)?gf:gx:m!==null?gf:mx})();return n=d,o=u,p}}function rI(t){t.undoStack=[],t.redoStack=[],t.current=null}function yj(t,e,n){let o=bj(t,n);return Be(t.registerCommand(ED,(()=>((function(i,s){let a=s.redoStack,l=s.undoStack;if(l.length!==0){let c=s.current,d=l.pop();c!==null&&(a.push(c),i.dispatchCommand(bs,!0)),l.length===0&&i.dispatchCommand(ys,!1),s.current=d||null,d&&d.editor.setEditorState(d.editorState,{tag:Ga})}})(t,e),!0)),Ee),t.registerCommand(bD,(()=>((function(i,s){let a=s.redoStack,l=s.undoStack;if(a.length!==0){let c=s.current;c!==null&&(l.push(c),i.dispatchCommand(ys,!0));let d=a.pop();a.length===0&&i.dispatchCommand(bs,!1),s.current=d||null,d&&d.editor.setEditorState(d.editorState,{tag:Ga})}})(t,e),!0)),Ee),t.registerCommand(aD,(()=>(rI(e),!1)),Ee),t.registerCommand(lD,(()=>(rI(e),t.dispatchCommand(bs,!1),t.dispatchCommand(ys,!1),!0)),Ee),t.registerUpdateListener((({editorState:i,prevEditorState:s,dirtyLeaves:a,dirtyElements:l,tags:c})=>{let d=e.current,u=e.redoStack,p=e.undoStack,f=d===null?null:d.editorState;if(d!==null&&i===f)return;let h=o(s,i,d,a,l,c);if(h===gx)u.length!==0&&(e.redoStack=[],t.dispatchCommand(bs,!1)),d!==null&&(p.push({...d}),t.dispatchCommand(ys,!0));else if(h===mx)return;e.current={editor:t,editorState:i}})))}function xj(){return{current:null,redoStack:[],undoStack:[]}}var iI=_x,mf=iI.createEmptyHistoryState,sI=iI.registerHistory;var bx={};Re(bx,{HistoryPlugin:()=>vj,createEmptyHistoryState:()=>mf});pt();function vj({delay:t,externalHistoryState:e}){let[n]=be();return(function(o,r,i=1e3){let s=J((()=>r||mf()),[r]);P((()=>sI(o,s,i)),[i,o,s])})(n,e,t),null}var aI=bx,lI=aI.HistoryPlugin,cI=aI.createEmptyHistoryState;var yx={};Re(yx,{useLexicalNodeSelection:()=>Cj});pt();function dI(t,e){return t.getEditorState().read((()=>{let n=St(e);return n!==null&&n.isSelected()}))}function Cj(t){let[e]=be(),[n,o]=R((()=>dI(e,t)));return P((()=>{let r=!0,i=e.registerUpdateListener((()=>{r&&o(dI(e,t))}));return()=>{r=!1,i()}}),[e,t]),[n,we((r=>{e.update((()=>{let i=$();ct(i)||(i=G1(),gt(i)),ct(i)&&(r?i.add(t):i.delete(t))}))}),[e,t]),we((()=>{e.update((()=>{let r=$();ct(r)&&r.clear()}))}),[e])]}var Ej=yx,_f=Ej.useLexicalNodeSelection;var vx={};Re(vx,{$createHorizontalRuleNode:()=>xx,$isHorizontalRuleNode:()=>kj,HorizontalRuleNode:()=>Gc,INSERT_HORIZONTAL_RULE_COMMAND:()=>wj});pt();var wj=Rn("INSERT_HORIZONTAL_RULE_COMMAND");function Tj({nodeKey:t}){let[e]=be(),[n,o,r]=_f(t);return P((()=>Be(e.registerCommand(Xo,(i=>{let s=e.getElementByKey(t);return i.target===s&&(i.shiftKey||r(),o(!n),!0)}),Ae))),[r,e,n,t,o]),P((()=>{let i=e.getElementByKey(t),s=e._config.theme.hrSelected??"selected";i!==null&&(n?Ve(i,s):Fn(i,s))}),[e,n,t]),null}var Gc=class t extends Wa{static getType(){return"horizontalrule"}static clone(e){return new t(e.__key)}static importJSON(e){return xx().updateFromJSON(e)}static importDOM(){return{hr:()=>({conversion:Sj,priority:0})}}exportDOM(){return{element:document.createElement("hr")}}createDOM(e){let n=document.createElement("hr");return Ve(n,e.theme.hr),n}getTextContent(){return`
|
|
116
|
-
`}isInline(){return!1}updateDOM(){return!1}decorate(){return g(Tj,{nodeKey:this.__key})}};function Sj(){return{node:xx()}}function xx(){return Tt(new Gc)}function kj(t){return t instanceof Gc}var bf=vx,tl=bf.$createHorizontalRuleNode,uI=bf.$isHorizontalRuleNode,yf=bf.HorizontalRuleNode,xf=bf.INSERT_HORIZONTAL_RULE_COMMAND;var Cx={};Re(Cx,{HorizontalRulePlugin:()=>Nj});pt();function Nj(){let[t]=be();return P((()=>t.registerCommand(xf,(e=>{let n=$();if(!F(n))return!1;if(n.focus.getNode()!==null){let o=tl();lf(o)}return!0}),Ee)),[t]),null}var Dj=Cx,pI=Dj.HorizontalRulePlugin;var Ex={};Re(Ex,{LinkPlugin:()=>Oj});pt();function Oj({validateUrl:t,attributes:e}){let[n]=be();return P((()=>{if(!n.hasNodes([Za]))throw new Error("LinkPlugin: LinkNode not registered on editor");return Be(n.registerCommand(Bn,(o=>{if(o===null)return df(o),!0;if(typeof o=="string")return!(t!==void 0&&!t(o))&&(df(o,e),!0);{let{url:r,target:i,rel:s,title:a}=o;return df(r,{...e,rel:s,target:i,title:a}),!0}}),Ae),t!==void 0?n.registerCommand(wi,(o=>{let r=$();if(!F(r)||r.isCollapsed()||!Xn(o,ClipboardEvent)||o.clipboardData===null)return!1;let i=o.clipboardData.getData("text");return!!t(i)&&!r.getNodes().some((s=>G(s)))&&(n.dispatchCommand(Bn,{...e,url:i}),o.preventDefault(),!0)}),Ae):()=>{})}),[n,t,e]),null}var Ij=Ex,fI=Ij.LinkPlugin;var wx={};Re(wx,{ListPlugin:()=>Mj});pt();function Mj({hasStrictIndent:t=!1}){let[e]=be();return P((()=>{if(!e.hasNodes([tr,Ni]))throw new Error("ListPlugin: ListNode and/or ListItemNode not registered on editor")}),[e]),P((()=>{if(t)return HO(e)}),[e,t]),(function(n){P((()=>zO(n)),[n])})(e),null}var Aj=wx,hI=Aj.ListPlugin;var Tx={};Re(Tx,{useLexicalEditable:()=>Pj});pt();var Lj=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?un:P;function Rj(t){return{initialValueFn:()=>t.isEditable(),subscribe:e=>t.registerEditableListener(e)}}function Pj(){return(function(t){let[e]=be(),n=J((()=>t(e)),[e,t]),[o,r]=R((()=>n.initialValueFn())),i=Y(o);return Lj((()=>{let{initialValueFn:s,subscribe:a}=n,l=s();return i.current!==l&&(i.current=l,r(l)),a((c=>{i.current=c,r(c)}))}),[n,t]),o})(Rj)}var Fj=Tx,gI=Fj.useLexicalEditable;var Sx={};Re(Sx,{registerDragonSupport:()=>Bj});function Bj(t){let e=window.location.origin,n=o=>{if(o.origin!==e)return;let r=t.getRootElement();if(document.activeElement!==r)return;let i=o.data;if(typeof i=="string"){let s;try{s=JSON.parse(i)}catch{return}if(s&&s.protocol==="nuanria_messaging"&&s.type==="request"){let a=s.payload;if(a&&a.functionId==="makeChanges"){let l=a.args;if(l){let[c,d,u,p,f,h]=l;t.update((()=>{let m=$();if(F(m)){let _=m.anchor,b=_.getNode(),y=0,x=0;if(Q(b)&&c>=0&&d>=0&&(y=c,x=c+d,m.setTextNodeRange(b,y,b,x)),y===x&&u===""||(m.insertRawText(u),b=_.getNode()),Q(b)){y=p,x=p+f;let v=b.getTextContentSize();y=y>v?v:y,x=x>v?v:x,m.setTextNodeRange(b,y,b,x)}o.stopImmediatePropagation()}}))}}}}};return window.addEventListener("message",n,!0),()=>{window.removeEventListener("message",n,!0)}}var $j=Sx,mI=$j.registerDragonSupport;var kx={};Re(kx,{$generateHtmlFromNodes:()=>Hj,$generateNodesFromDOM:()=>zj});function zj(t,e){let n=e.body?e.body.childNodes:[],o=[],r=[];for(let i=0;i<n.length;i++){let s=n[i];if(!bI.has(s.nodeName)){let a=yI(s,t,r,!1);a!==null&&(o=o.concat(a))}}return(function(i){for(let s of i)s.getNextSibling()instanceof Ny&&s.insertAfter(Eo());for(let s of i){let a=s.getChildren();for(let l of a)s.insertBefore(l);s.remove()}})(r),o}function Hj(t,e){if(typeof document>"u"||typeof window>"u"&&global.window===void 0)throw new Error("To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.");let n=document.createElement("div"),o=Qe().getChildren();for(let r=0;r<o.length;r++)_I(t,o[r],n,e);return n.innerHTML}function _I(t,e,n,o=null){let r=o===null||e.isSelected(o),i=G(e)&&e.excludeFromCopy("html"),s=e;if(o!==null){let f=_i(e);f=Q(f)&&o!==null?of(o,f):f,s=f}let a=G(s)?s.getChildren():[],l=kD(t,s.getType()),c;c=l&&l.exportDOM!==void 0?l.exportDOM(t,s):s.exportDOM(t);let{element:d,after:u}=c;if(!d)return!1;let p=document.createDocumentFragment();for(let f=0;f<a.length;f++){let h=a[f],m=_I(t,h,p,o);!r&&G(e)&&m&&e.extractWithChild(h,o,"html")&&(r=!0)}if(r&&!i){if((Jt(d)||My(d))&&d.append(p),n.append(d),u){let f=u.call(s,d);f&&(My(d)?d.replaceChildren(f):d.replaceWith(f))}}else n.append(p);return r}var bI=new Set(["STYLE","SCRIPT"]);function yI(t,e,n,o,r=new Map,i){let s=[];if(bI.has(t.nodeName))return s;let a=null,l=(function(h,m){let{nodeName:_}=h,b=m._htmlConversions.get(_.toLowerCase()),y=null;if(b!==void 0)for(let x of b){let v=x(h);v!==null&&(y===null||(y.priority||0)<=(v.priority||0))&&(y=v)}return y!==null?y.conversion:null})(t,e),c=l?l(t):null,d=null;if(c!==null){d=c.after;let h=c.node;if(a=Array.isArray(h)?h[h.length-1]:h,a!==null){for(let[,m]of r)if(a=m(a,i),!a)break;a&&s.push(...Array.isArray(h)?h:[a])}c.forChild!=null&&r.set(t.nodeName,c.forChild)}let u=t.childNodes,p=[],f=(a==null||!Rt(a))&&(a!=null&&ja(a)||o);for(let h=0;h<u.length;h++)p.push(...yI(u[h],e,n,f,new Map(r),a));return d!=null&&(p=d(p)),Jy(t)&&(p=Kj(t,p,f?()=>{let h=new Ny;return n.push(h),h}:fe)),a==null?p.length>0?s=s.concat(p):Jy(t)&&(function(h){return h.nextSibling==null||h.previousSibling==null?!1:$c(h.nextSibling)&&$c(h.previousSibling)})(t)&&(s=s.concat(Eo())):G(a)&&a.append(...p),s}function Kj(t,e,n){let o=t.style.textAlign,r=[],i=[];for(let s=0;s<e.length;s++){let a=e[s];if(ja(a))o&&!a.getFormat()&&a.setFormat(o),r.push(a);else if(i.push(a),s===e.length-1||s<e.length-1&&ja(e[s+1])){let l=n();l.setFormat(o),l.append(...i),r.push(l),i=[]}}return r}var xI=kx,vI=xI.$generateHtmlFromNodes,vf=xI.$generateNodesFromDOM;var Dx={};Re(Dx,{$generateJSONFromSelectedNodes:()=>SI,$generateNodesFromSerializedNodes:()=>kI,$getClipboardDataFromSelection:()=>NI,$getHtmlContent:()=>EI,$getLexicalContent:()=>wI,$insertDataTransferForPlainText:()=>Uj,$insertDataTransferForRichText:()=>jj,$insertGeneratedNodes:()=>Nx,copyToClipboard:()=>Vj,setLexicalClipboardDataTransfer:()=>DI});function Cf(t,...e){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",t);for(let r of e)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function EI(t,e=$()){return e==null&&Cf(166),F(e)&&e.isCollapsed()||e.getNodes().length===0?"":vI(t,e)}function wI(t,e=$()){return e==null&&Cf(166),F(e)&&e.isCollapsed()||e.getNodes().length===0?null:JSON.stringify(SI(t,e))}function Uj(t,e){let n=t.getData("text/plain")||t.getData("text/uri-list");n!=null&&e.insertRawText(n)}function jj(t,e,n){let o=t.getData("application/x-lexical-editor");if(o)try{let a=JSON.parse(o);if(a.namespace===n._config.namespace&&Array.isArray(a.nodes))return Nx(n,kI(a.nodes),e)}catch{}let r=t.getData("text/html"),i=t.getData("text/plain");if(r&&i!==r)try{let a=new DOMParser().parseFromString((function(l){return window.trustedTypes&&window.trustedTypes.createPolicy?window.trustedTypes.createPolicy("lexical",{createHTML:c=>c}).createHTML(l):l})(r),"text/html");return Nx(n,vf(n,a),e)}catch{}let s=i||t.getData("text/uri-list");if(s!=null)if(F(e)){let a=s.split(/(\r?\n|\t)/);a[a.length-1]===""&&a.pop();for(let l=0;l<a.length;l++){let c=$();if(F(c)){let d=a[l];d===`
|
|
117
|
-
`||d===`\r
|
|
118
|
-
`?c.insertParagraph():d===" "?c.insertNodes([wo()]):c.insertText(d)}}}else e.insertRawText(s)}function Nx(t,e,n){t.dispatchCommand(Bc,{nodes:e,selection:n})||(n.insertNodes(e),(function(o){if(F(o)&&o.isCollapsed()){let r=o.anchor,i=null,s=mi(r,"previous");if(s)if(zp(s))i=s.origin;else{let a=Fp(s,qn(Qe(),"next").getFlipped());for(let l of a){if(Q(l.origin)){i=l.origin;break}if(G(l.origin)&&!l.origin.isInline())break}}if(i&&Q(i)){let a=i.getFormat(),l=i.getStyle();o.format===a&&o.style===l||(o.format=a,o.style=l,o.dirty=!0)}}})(n))}function TI(t,e,n,o=[]){let r=e===null||n.isSelected(e),i=G(n)&&n.excludeFromCopy("html"),s=n;if(e!==null){let c=_i(n);c=Q(c)&&e!==null?of(e,c):c,s=c}let a=G(s)?s.getChildren():[],l=(function(c){let d=c.exportJSON(),u=c.constructor;if(d.type!==u.getType()&&Cf(58,u.name),G(c)){let p=d.children;Array.isArray(p)||Cf(59,u.name)}return d})(s);if(Q(s)){let c=s.__text;c.length>0?l.text=c:r=!1}for(let c=0;c<a.length;c++){let d=a[c],u=TI(t,e,d,l.children);!r&&G(n)&&u&&n.extractWithChild(d,e,"clone")&&(r=!0)}if(r&&!i)o.push(l);else if(Array.isArray(l.children))for(let c=0;c<l.children.length;c++){let d=l.children[c];o.push(d)}return r}function SI(t,e){let n=[],o=Qe().getChildren();for(let r=0;r<o.length;r++)TI(t,e,o[r],n);return{namespace:t._config.namespace,nodes:n}}function kI(t){let e=[];for(let n=0;n<t.length;n++){let o=t[n],r=nD(o);Q(r)&&WD(r),e.push(r)}return e}var nl=null;async function Vj(t,e,n){if(nl!==null)return!1;if(e!==null)return new Promise(((c,d)=>{t.update((()=>{c(CI(t,e,n))}))}));let o=t.getRootElement(),r=t._window||window,i=window.document,s=Jn(r);if(o===null||s===null)return!1;let a=i.createElement("span");a.style.cssText="position: fixed; top: -1000px;",a.append(i.createTextNode("#")),o.append(a);let l=new Range;return l.setStart(a,0),l.setEnd(a,1),s.removeAllRanges(),s.addRange(l),new Promise(((c,d)=>{let u=t.registerCommand(Vp,(p=>(Xn(p,ClipboardEvent)&&(u(),nl!==null&&(window.clearTimeout(nl),nl=null),c(CI(t,p,n))),!0)),Ct);nl=window.setTimeout((()=>{u(),nl=null,c(!1)}),50),i.execCommand("copy"),a.remove()}))}function CI(t,e,n){if(n===void 0){let r=Jn(t._window);if(!r)return!1;let i=r.anchorNode,s=r.focusNode;if(i!==null&&s!==null&&!MD(t,i,s))return!1;let a=$();if(a===null)return!1;n=NI(a)}e.preventDefault();let o=e.clipboardData;return o!==null&&(DI(o,n),!0)}var Wj=[["text/html",EI],["application/x-lexical-editor",wI]];function NI(t=$()){let e={"text/plain":t?t.getTextContent():""};if(t){let n=_s();for(let[o,r]of Wj){let i=r(n,t);i!==null&&(e[o]=i)}}return e}function DI(t,e){for(let n in e){let o=e[n];o!==void 0&&t.setData(n,o)}}var nr=Dx,qne=nr.$generateJSONFromSelectedNodes,Jne=nr.$generateNodesFromSerializedNodes,OI=nr.$getClipboardDataFromSelection,Xne=nr.$getHtmlContent,Zne=nr.$getLexicalContent,Qne=nr.$insertDataTransferForPlainText,Ox=nr.$insertDataTransferForRichText,eoe=nr.$insertGeneratedNodes,Yc=nr.copyToClipboard,toe=nr.setLexicalClipboardDataTransfer;var Lx={};Re(Lx,{$createHeadingNode:()=>rl,$createQuoteNode:()=>Ax,$isHeadingNode:()=>e8,$isQuoteNode:()=>Zj,DRAG_DROP_PASTE:()=>Mx,HeadingNode:()=>Xc,QuoteNode:()=>Jc,eventFiles:()=>qc,registerRichText:()=>t8});function II(t,e){if(document.caretRangeFromPoint!==void 0){let n=document.caretRangeFromPoint(t,e);return n===null?null:{node:n.startContainer,offset:n.startOffset}}if(document.caretPositionFromPoint!=="undefined"){let n=document.caretPositionFromPoint(t,e);return n===null?null:{node:n.offsetNode,offset:n.offset}}return null}var il=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,Gj=il&&"documentMode"in document?document.documentMode:null,Yj=!(!il||!("InputEvent"in window)||Gj)&&"getTargetRanges"in new window.InputEvent("input"),qj=il&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),MI=il&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Jj=il&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Xj=il&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!Jj,Mx=Rn("DRAG_DROP_PASTE_FILE"),Jc=class t extends Pt{static getType(){return"quote"}static clone(e){return new t(e.__key)}createDOM(e){let n=document.createElement("blockquote");return Ve(n,e.theme.quote),n}updateDOM(e,n){return!1}static importDOM(){return{blockquote:e=>({conversion:Qj,priority:0})}}exportDOM(e){let{element:n}=super.exportDOM(e);if(Jt(n)){this.isEmpty()&&n.append(document.createElement("br"));let o=this.getFormatType();o&&(n.style.textAlign=o);let r=this.getDirection();r&&(n.dir=r)}return{element:n}}static importJSON(e){return Ax().updateFromJSON(e)}insertNewAfter(e,n){let o=fe(),r=this.getDirection();return o.setDirection(r),this.insertAfter(o,n),o}collapseAtStart(){let e=fe();return this.getChildren().forEach((n=>e.append(n))),this.replace(e),!0}canMergeWhenEmpty(){return!0}};function Ax(){return Tt(new Jc)}function Zj(t){return t instanceof Jc}var Xc=class t extends Pt{static getType(){return"heading"}static clone(e){return new t(e.__tag,e.__key)}constructor(e,n){super(n),this.__tag=e}getTag(){return this.__tag}setTag(e){let n=this.getWritable();return this.__tag=e,n}createDOM(e){let n=this.__tag,o=document.createElement(n),r=e.theme.heading;if(r!==void 0){let i=r[n];Ve(o,i)}return o}updateDOM(e,n,o){return e.__tag!==this.__tag}static importDOM(){return{h1:e=>({conversion:ol,priority:0}),h2:e=>({conversion:ol,priority:0}),h3:e=>({conversion:ol,priority:0}),h4:e=>({conversion:ol,priority:0}),h5:e=>({conversion:ol,priority:0}),h6:e=>({conversion:ol,priority:0}),p:e=>{let n=e.firstChild;return n!==null&&AI(n)?{conversion:()=>({node:null}),priority:3}:null},span:e=>AI(e)?{conversion:n=>({node:rl("h1")}),priority:3}:null}}exportDOM(e){let{element:n}=super.exportDOM(e);if(Jt(n)){this.isEmpty()&&n.append(document.createElement("br"));let o=this.getFormatType();o&&(n.style.textAlign=o);let r=this.getDirection();r&&(n.dir=r)}return{element:n}}static importJSON(e){return rl(e.tag).updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setTag(e.tag)}exportJSON(){return{...super.exportJSON(),tag:this.getTag()}}insertNewAfter(e,n=!0){let o=e?e.anchor.offset:0,r=this.getLastDescendant(),i=!r||e&&e.anchor.key===r.getKey()&&o===r.getTextContentSize()||!e?fe():rl(this.getTag()),s=this.getDirection();if(i.setDirection(s),this.insertAfter(i,n),o===0&&!this.isEmpty()&&e){let a=fe();a.select(),this.replace(a,!0)}return i}collapseAtStart(){let e=this.isEmpty()?fe():rl(this.getTag());return this.getChildren().forEach((n=>e.append(n))),this.replace(e),!0}extractWithChild(){return!0}};function AI(t){return t.nodeName.toLowerCase()==="span"&&t.style.fontSize==="26pt"}function ol(t){let e=t.nodeName.toLowerCase(),n=null;return e!=="h1"&&e!=="h2"&&e!=="h3"&&e!=="h4"&&e!=="h5"&&e!=="h6"||(n=rl(e),t.style!==null&&(Ly(t,n),n.setFormat(t.style.textAlign))),{node:n}}function Qj(t){let e=Ax();return t.style!==null&&(e.setFormat(t.style.textAlign),Ly(t,e)),{node:e}}function rl(t="h1"){return Tt(new Xc(t))}function e8(t){return t instanceof Xc}function qc(t){let e=null;if(Xn(t,DragEvent)?e=t.dataTransfer:Xn(t,ClipboardEvent)&&(e=t.clipboardData),e===null)return[!1,[],!1];let n=e.types,o=n.includes("Files"),r=n.includes("text/html")||n.includes("text/plain");return[o,Array.from(e.files),r]}function LI(t){let e=$();if(!F(e))return!1;let n=new Set,o=e.getNodes();for(let r=0;r<o.length;r++){let i=o[r],s=i.getKey();if(n.has(s))continue;let a=le(i,(c=>G(c)&&!c.isInline()));if(a===null)continue;let l=a.getKey();a.canIndent()&&!n.has(l)&&(n.add(l),t(a))}return n.size>0}function RI(t){let e=on(t);return Mn(e)}function Ix(t){for(let e of["lowercase","uppercase","capitalize"])t.hasFormat(e)&&t.toggleFormat(e)}function t8(t){return Be(t.registerCommand(Xo,(e=>{let n=$();return!!ct(n)&&(n.clear(),!0)}),Ee),t.registerCommand(Va,(e=>{let n=$();return F(n)?(n.deleteCharacter(e),!0):!!ct(n)&&(n.deleteNodes(),!0)}),Ee),t.registerCommand(Gp,(e=>{let n=$();return!!F(n)&&(n.deleteWord(e),!0)}),Ee),t.registerCommand(Pc,(e=>{let n=$();return!!F(n)&&(n.deleteLine(e),!0)}),Ee),t.registerCommand(jp,(e=>{let n=$();if(typeof e=="string")n!==null&&n.insertText(e);else{if(n===null)return!1;let o=e.dataTransfer;if(o!=null)Ox(o,n,t);else if(F(n)){let r=e.data;return r&&n.insertText(r),!0}}return!0}),Ee),t.registerCommand(yD,(()=>{let e=$();return!!F(e)&&(e.removeText(),!0)}),Ee),t.registerCommand(ot,(e=>{let n=$();return!!F(n)&&(n.formatText(e),!0)}),Ee),t.registerCommand(Yp,(e=>{let n=$();if(!F(n)&&!ct(n))return!1;let o=n.getNodes();for(let r of o){let i=le(r,(s=>G(s)&&!s.isInline()));i!==null&&i.setFormat(e)}return!0}),Ee),t.registerCommand(Dy,(e=>{let n=$();return!!F(n)&&(n.insertLineBreak(e),!0)}),Ee),t.registerCommand(vi,(()=>{let e=$();return!!F(e)&&(e.insertParagraph(),!0)}),Ee),t.registerCommand(xs,(()=>(To([wo()]),!0)),Ee),t.registerCommand(Ln,(()=>LI((e=>{let n=e.getIndent();e.setIndent(n+1)}))),Ee),t.registerCommand(uo,(()=>LI((e=>{let n=e.getIndent();n>0&&e.setIndent(Math.max(0,n-1))}))),Ee),t.registerCommand(So,(e=>{let n=$();if(ct(n)){let o=n.getNodes();if(o.length>0)return o[0].selectPrevious(),!0}else if(F(n)){let o=wy(n.focus,!0);if(!e.shiftKey&&Mn(o)&&!o.isIsolated()&&!o.isInline())return o.selectPrevious(),e.preventDefault(),!0}return!1}),Ee),t.registerCommand(Rr,(e=>{let n=$();if(ct(n)){let o=n.getNodes();if(o.length>0)return o[0].selectNext(0,0),!0}else if(F(n)){if((function(r){let i=r.focus;return i.key==="root"&&i.offset===Qe().getChildrenSize()})(n))return e.preventDefault(),!0;let o=wy(n.focus,!1);if(!e.shiftKey&&Mn(o)&&!o.isIsolated()&&!o.isInline())return o.selectNext(),e.preventDefault(),!0}return!1}),Ee),t.registerCommand(qa,(e=>{let n=$();if(ct(n)){let o=n.getNodes();if(o.length>0)return e.preventDefault(),o[0].selectPrevious(),!0}if(!F(n))return!1;if(Ky(n,!0)){let o=e.shiftKey;return e.preventDefault(),Hy(n,o,!0),!0}return!1}),Ee),t.registerCommand(qp,(e=>{let n=$();if(ct(n)){let r=n.getNodes();if(r.length>0)return e.preventDefault(),r[0].selectNext(0,0),!0}if(!F(n))return!1;let o=e.shiftKey;return!!Ky(n,!1)&&(e.preventDefault(),Hy(n,o,!1),!0)}),Ee),t.registerCommand(Jp,(e=>{if(RI(e.target))return!1;let n=$();if(F(n)){if((function(o){if(!o.isCollapsed())return!1;let{anchor:r}=o;if(r.offset!==0)return!1;let i=r.getNode();if(qo(i))return!1;let s=Cs(i);return s.getIndent()>0&&(s.is(i)||i.is(s.getFirstDescendant()))})(n))return e.preventDefault(),t.dispatchCommand(uo,void 0);if(MI&&navigator.language==="ko-KR")return!1}else if(!ct(n))return!1;return e.preventDefault(),t.dispatchCommand(Va,!0)}),Ee),t.registerCommand(Xp,(e=>{if(RI(e.target))return!1;let n=$();return!(!F(n)&&!ct(n))&&(e.preventDefault(),t.dispatchCommand(Va,!1))}),Ee),t.registerCommand(mD,(e=>{let n=$();if(!F(n))return!1;if(Ix(n),e!==null){if((MI||qj||Xj)&&Yj)return!1;if(e.preventDefault(),e.shiftKey)return t.dispatchCommand(Dy,!1)}return t.dispatchCommand(vi,void 0)}),Ee),t.registerCommand(Ci,(()=>{let e=$();return!!F(e)&&(t.blur(),!0)}),Ee),t.registerCommand(pD,(e=>{let[,n]=qc(e);if(n.length>0){let r=II(e.clientX,e.clientY);if(r!==null){let{offset:i,node:s}=r,a=on(s);if(a!==null){let l=Yo();if(Q(a))l.anchor.set(a.getKey(),i,"text"),l.focus.set(a.getKey(),i,"text");else{let d=a.getParentOrThrow().getKey(),u=a.getIndexWithinParent()+1;l.anchor.set(d,u,"element"),l.focus.set(d,u,"element")}let c=Lr(l);gt(c)}t.dispatchCommand(Mx,n)}return e.preventDefault(),!0}let o=$();return!!F(o)}),Ee),t.registerCommand(uD,(e=>{let[n]=qc(e),o=$();return!(n&&!F(o))}),Ee),t.registerCommand(dD,(e=>{let[n]=qc(e),o=$();if(n&&!F(o))return!1;let r=II(e.clientX,e.clientY);if(r!==null){let i=on(r.node);Mn(i)&&e.preventDefault()}return!0}),Ee),t.registerCommand(vD,(()=>(Hp(),!0)),Ee),t.registerCommand(Vp,(e=>(Yc(t,Xn(e,ClipboardEvent)?e:null),!0)),Ee),t.registerCommand(Wp,(e=>((async function(n,o){await Yc(o,Xn(n,ClipboardEvent)?n:null),o.update((()=>{let r=$();F(r)?r.removeText():ct(r)&&r.getNodes().forEach((i=>i.remove()))}))})(e,t),!0)),Ee),t.registerCommand(wi,(e=>{let[,n,o]=qc(e);return n.length>0&&!o?(t.dispatchCommand(Mx,n),!0):Ti(e.target)&&ID(e.target)?!1:$()!==null&&((function(r,i){r.preventDefault(),i.update((()=>{let s=$(),a=Xn(r,InputEvent)||Xn(r,KeyboardEvent)?null:r.clipboardData;a!=null&&s!==null&&Ox(a,s,i)}),{tag:_D})})(e,t),!0)}),Ee),t.registerCommand(Zp,(e=>{let n=$();return F(n)&&Ix(n),!1}),Ee),t.registerCommand(Ei,(e=>{let n=$();return F(n)&&Ix(n),!1}),Ee))}var Pr=Lx,Ss=Pr.$createHeadingNode,ks=Pr.$createQuoteNode,Fr=Pr.$isHeadingNode,Br=Pr.$isQuoteNode,aoe=Pr.DRAG_DROP_PASTE,Ef=Pr.HeadingNode,wf=Pr.QuoteNode,loe=Pr.eventFiles,PI=Pr.registerRichText;var Px={};Re(Px,{RichTextPlugin:()=>n8});pt();pt();var Rx=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?un:P;function FI(t){return t.getEditorState().read(hf(t.isComposing()))}function n8({contentEditable:t,placeholder:e=null,ErrorBoundary:n}){let[o]=be(),r=(function(i,s){let[a,l]=R((()=>i.getDecorators()));return Rx((()=>i.registerDecoratorListener((c=>{vl((()=>{l(c)}))}))),[i]),P((()=>{l(i.getDecorators())}),[i]),J((()=>{let c=[],d=Object.keys(a);for(let u=0;u<d.length;u++){let p=d[u],f=g(s,{onError:m=>i._onError(m),children:g(Kv,{fallback:null,children:a[p]})}),h=i.getElementByKey(p);h!==null&&c.push(Yr(f,h,p))}return c}),[s,a,i])})(o,n);return(function(i){Rx((()=>Be(PI(i),mI(i))),[i])})(o),g(Me,{children:[t,g(o8,{content:e}),r]})}function o8({content:t}){let[e]=be(),n=(function(r){let[i,s]=R((()=>FI(r)));return Rx((()=>{function a(){let l=FI(r);s(l)}return a(),Be(r.registerUpdateListener((()=>{a()})),r.registerEditableListener((()=>{a()})))}),[r]),i})(e),o=gI();return n?typeof t=="function"?t(o):t:null}var r8=Px,BI=r8.RichTextPlugin;var Fx={};Re(Fx,{TabIndentationPlugin:()=>i8,registerTabIndentation:()=>$I});pt();function $I(t,e){return Be(t.registerCommand(Ei,(n=>{let o=$();if(!F(o))return!1;n.preventDefault();let r=(function(i){let s=i.getNodes();if(pO(s,(p=>ja(p)&&p.canIndent()?p:null)).length>0)return!0;let a=i.anchor,l=i.focus,c=l.isBefore(a)?l:a,d=c.getNode(),u=Cs(d);if(u.canIndent()){let p=u.getKey(),f=Yo();if(f.anchor.set(p,0,"element"),f.focus.set(p,0,"element"),f=Lr(f),f.anchor.is(c))return!0}return!1})(o)?n.shiftKey?uo:Ln:xs;return t.dispatchCommand(r,void 0)}),Ee),t.registerCommand(Ln,(()=>{if(e==null)return!1;let n=$();if(!F(n))return!1;let o=n.getNodes().map((r=>Cs(r).getIndent()));return Math.max(...o)+1>=e}),Ct))}function i8({maxIndent:t}){let[e]=be();return P((()=>$I(e,t)),[e,t]),null}var zI=Fx,HI=zI.TabIndentationPlugin,woe=zI.registerTabIndentation;var nv={};Re(nv,{$computeTableMap:()=>rn,$computeTableMapSkipCellCheck:()=>zr,$createTableCellNode:()=>zn,$createTableNode:()=>Af,$createTableNodeWithDimensions:()=>XI,$createTableRowNode:()=>Os,$createTableSelection:()=>Zx,$createTableSelectionFrom:()=>iM,$deleteTableColumn:()=>m8,$deleteTableColumnAtSelection:()=>nM,$deleteTableColumn__EXPERIMENTAL:()=>b8,$deleteTableRowAtSelection:()=>tM,$deleteTableRow__EXPERIMENTAL:()=>_8,$findCellNode:()=>ll,$findTableNode:()=>Ds,$getElementForTableNode:()=>dM,$getNodeTriplet:()=>Bt,$getTableAndElementByKey:()=>Qx,$getTableCellNodeFromLexicalNode:()=>l8,$getTableCellNodeRect:()=>Ux,$getTableColumnIndexFromTableCellNode:()=>d8,$getTableNodeFromLexicalNodeOrThrow:()=>Mf,$getTableRowIndexFromTableCellNode:()=>c8,$getTableRowNodeFromTableCellNodeOrThrow:()=>Jx,$insertTableColumn:()=>h8,$insertTableColumnAtSelection:()=>eM,$insertTableColumn__EXPERIMENTAL:()=>g8,$insertTableRow:()=>p8,$insertTableRowAtSelection:()=>QI,$insertTableRow__EXPERIMENTAL:()=>f8,$isScrollableTablesActive:()=>If,$isTableCellNode:()=>ce,$isTableNode:()=>rt,$isTableRowNode:()=>We,$isTableSelection:()=>ze,$mergeCells:()=>oM,$removeTableRowAtIndex:()=>u8,$unmergeCell:()=>x8,INSERT_TABLE_COMMAND:()=>JI,TableCellHeaderStates:()=>Ge,TableCellNode:()=>Di,TableNode:()=>Ii,TableObserver:()=>Of,TableRowNode:()=>dl,applyTableHandlers:()=>sM,getDOMCellFromTarget:()=>ed,getTableElement:()=>Oi,getTableObserverFromTableElement:()=>Vx,registerTableCellUnmergeTransform:()=>P8,registerTablePlugin:()=>B8,registerTableSelectionObserver:()=>F8,setScrollableTablesActive:()=>D8});var Yx=/^(\d+(?:\.\d+)?)px$/,Ge={BOTH:3,COLUMN:2,NO_STATUS:0,ROW:1},Di=class t extends Pt{static getType(){return"tablecell"}static clone(e){return new t(e.__headerState,e.__colSpan,e.__width,e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__rowSpan=e.__rowSpan,this.__backgroundColor=e.__backgroundColor,this.__verticalAlign=e.__verticalAlign}static importDOM(){return{td:e=>({conversion:KI,priority:0}),th:e=>({conversion:KI,priority:0})}}static importJSON(e){return zn().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setHeaderStyles(e.headerState).setColSpan(e.colSpan||1).setRowSpan(e.rowSpan||1).setWidth(e.width||void 0).setBackgroundColor(e.backgroundColor||null).setVerticalAlign(e.verticalAlign||void 0)}constructor(e=Ge.NO_STATUS,n=1,o,r){super(r),this.__colSpan=n,this.__rowSpan=1,this.__headerState=e,this.__width=o,this.__backgroundColor=null,this.__verticalAlign=void 0}createDOM(e){let n=document.createElement(this.getTag());return this.__width&&(n.style.width=`${this.__width}px`),this.__colSpan>1&&(n.colSpan=this.__colSpan),this.__rowSpan>1&&(n.rowSpan=this.__rowSpan),this.__backgroundColor!==null&&(n.style.backgroundColor=this.__backgroundColor),$x(this.__verticalAlign)&&(n.style.verticalAlign=this.__verticalAlign),Ve(n,e.theme.tableCell,this.hasHeader()&&e.theme.tableCellHeader),n}exportDOM(e){let n=super.exportDOM(e);if(vs(n.element)){let o=n.element;o.setAttribute("data-temporary-table-cell-lexical-key",this.getKey()),o.style.border="1px solid black",this.__colSpan>1&&(o.colSpan=this.__colSpan),this.__rowSpan>1&&(o.rowSpan=this.__rowSpan),o.style.width=`${this.getWidth()||75}px`,o.style.verticalAlign=this.getVerticalAlign()||"top",o.style.textAlign="start",this.__backgroundColor===null&&this.hasHeader()&&(o.style.backgroundColor="#f2f3f5")}return n}exportJSON(){return{...super.exportJSON(),...$x(this.__verticalAlign)&&{verticalAlign:this.__verticalAlign},backgroundColor:this.getBackgroundColor(),colSpan:this.__colSpan,headerState:this.__headerState,rowSpan:this.__rowSpan,width:this.getWidth()}}getColSpan(){return this.getLatest().__colSpan}setColSpan(e){let n=this.getWritable();return n.__colSpan=e,n}getRowSpan(){return this.getLatest().__rowSpan}setRowSpan(e){let n=this.getWritable();return n.__rowSpan=e,n}getTag(){return this.hasHeader()?"th":"td"}setHeaderStyles(e,n=Ge.BOTH){let o=this.getWritable();return o.__headerState=e&n|o.__headerState&~n,o}getHeaderStyles(){return this.getLatest().__headerState}setWidth(e){let n=this.getWritable();return n.__width=e,n}getWidth(){return this.getLatest().__width}getBackgroundColor(){return this.getLatest().__backgroundColor}setBackgroundColor(e){let n=this.getWritable();return n.__backgroundColor=e,n}getVerticalAlign(){return this.getLatest().__verticalAlign}setVerticalAlign(e){let n=this.getWritable();return n.__verticalAlign=e||void 0,n}toggleHeaderStyle(e){let n=this.getWritable();return(n.__headerState&e)===e?n.__headerState-=e:n.__headerState+=e,n}hasHeaderState(e){return(this.getHeaderStyles()&e)===e}hasHeader(){return this.getLatest().__headerState!==Ge.NO_STATUS}updateDOM(e){return e.__headerState!==this.__headerState||e.__width!==this.__width||e.__colSpan!==this.__colSpan||e.__rowSpan!==this.__rowSpan||e.__backgroundColor!==this.__backgroundColor||e.__verticalAlign!==this.__verticalAlign}isShadowRoot(){return!0}collapseAtStart(){return!0}canBeEmpty(){return!1}canIndent(){return!1}};function $x(t){return t==="middle"||t==="bottom"}function KI(t){let e=t,n=t.nodeName.toLowerCase(),o;Yx.test(e.style.width)&&(o=parseFloat(e.style.width));let r=zn(n==="th"?Ge.ROW:Ge.NO_STATUS,e.colSpan,o);r.__rowSpan=e.rowSpan;let i=e.style.backgroundColor;i!==""&&(r.__backgroundColor=i);let s=e.style.verticalAlign;$x(s)&&(r.__verticalAlign=s);let a=e.style,l=(a&&a.textDecoration||"").split(" "),c=a.fontWeight==="700"||a.fontWeight==="bold",d=l.includes("line-through"),u=a.fontStyle==="italic",p=l.includes("underline");return{after:f=>{let h=[],m=null,_=()=>{if(m){let b=m.getFirstChild();qe(b)&&m.getChildrenSize()===1&&b.remove()}};for(let b of f)tD(b)||Q(b)||qe(b)?(Q(b)&&(c&&b.toggleFormat("bold"),d&&b.toggleFormat("strikethrough"),u&&b.toggleFormat("italic"),p&&b.toggleFormat("underline")),m?m.append(b):(m=fe().append(b),h.push(m))):(h.push(b),_(),m=null);return _(),h.length===0&&h.push(fe()),h},node:r}}function zn(t=Ge.NO_STATUS,e=1,n){return Tt(new Di(t,e,n))}function ce(t){return t instanceof Di}var JI=Rn("INSERT_TABLE_COMMAND");function ie(t,...e){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",t);for(let r of e)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var dl=class t extends Pt{static getType(){return"tablerow"}static clone(e){return new t(e.__height,e.__key)}static importDOM(){return{tr:e=>({conversion:s8,priority:0})}}static importJSON(e){return Os().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setHeight(e.height)}constructor(e,n){super(n),this.__height=e}exportJSON(){let e=this.getHeight();return{...super.exportJSON(),...e===void 0?void 0:{height:e}}}createDOM(e){let n=document.createElement("tr");return this.__height&&(n.style.height=`${this.__height}px`),Ve(n,e.theme.tableRow),n}extractWithChild(e,n,o){return o==="html"}isShadowRoot(){return!0}setHeight(e){let n=this.getWritable();return n.__height=e,n}getHeight(){return this.getLatest().__height}updateDOM(e){return e.__height!==this.__height}canBeEmpty(){return!1}canIndent(){return!1}};function s8(t){let e=t,n;return Yx.test(e.style.height)&&(n=parseFloat(e.style.height)),{after:o=>Yy(o,ce),node:Os(n)}}function Os(t){return Tt(new dl(t))}function We(t){return t instanceof dl}var qx=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,a8=qx&&"documentMode"in document?document.documentMode:null,UI=qx&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent);function XI(t,e,n=!0){let o=Af();for(let r=0;r<t;r++){let i=Os();for(let s=0;s<e;s++){let a=Ge.NO_STATUS;typeof n=="object"?(r===0&&n.rows&&(a|=Ge.ROW),s===0&&n.columns&&(a|=Ge.COLUMN)):n&&(r===0&&(a|=Ge.ROW),s===0&&(a|=Ge.COLUMN));let l=zn(a),c=fe();c.append(vt()),l.append(c),i.append(l)}o.append(i)}return o}function l8(t){let e=le(t,(n=>ce(n)));return ce(e)?e:null}function Jx(t){let e=le(t,(n=>We(n)));if(We(e))return e;throw new Error("Expected table cell to be inside of table row.")}function Mf(t){let e=le(t,(n=>rt(n)));if(rt(e))return e;throw new Error("Expected table cell to be inside of table.")}function c8(t){let e=Jx(t);return Mf(e).getChildren().findIndex((n=>n.is(e)))}function d8(t){return Jx(t).getChildren().findIndex((e=>e.is(t)))}function ZI(t,e){let n=Mf(t),{x:o,y:r}=n.getCordsFromCellNode(t,e);return{above:n.getCellNodeFromCords(o,r-1,e),below:n.getCellNodeFromCords(o,r+1,e),left:n.getCellNodeFromCords(o-1,r,e),right:n.getCellNodeFromCords(o+1,r,e)}}function u8(t,e){let n=t.getChildren();if(e>=n.length||e<0)throw new Error("Expected table cell to be inside of table row.");return n[e].remove(),t}function p8(t,e,n=!0,o,r){let i=t.getChildren();if(e>=i.length||e<0)throw new Error("Table row target index out of range");let s=i[e];if(!We(s))throw new Error("Row before insertion index does not exist.");for(let a=0;a<o;a++){let l=s.getChildren(),c=l.length,d=Os();for(let u=0;u<c;u++){let p=l[u];ce(p)||ie(12);let{above:f,below:h}=ZI(p,r),m=Ge.NO_STATUS,_=f&&f.getWidth()||h&&h.getWidth()||void 0;(f&&f.hasHeaderState(Ge.COLUMN)||h&&h.hasHeaderState(Ge.COLUMN))&&(m|=Ge.COLUMN);let b=zn(m,1,_);b.append(fe()),d.append(b)}n?s.insertAfter(d):s.insertBefore(d)}return t}qx&&"InputEvent"in window&&!a8&&new window.InputEvent("input");var zx=(t,e)=>t===Ge.BOTH||t===e?e:Ge.NO_STATUS;function QI(t=!0){let e=$();F(e)||ze(e)||ie(188);let n=e.anchor.getNode(),o=e.focus.getNode(),[r]=Bt(n),[i,,s]=Bt(o),[,a,l]=rn(s,i,r),{startRow:c}=l,{startRow:d}=a;return t?Hx(c+r.__rowSpan>d+i.__rowSpan?r:i,!0):Hx(d<c?i:r,!1)}var f8=QI;function Hx(t,e=!0){let[,,n]=Bt(t),[o,r]=rn(n,t,t),i=o[0].length,{startRow:s}=r,a=null;if(e){let l=s+t.__rowSpan-1,c=o[l],d=Os();for(let p=0;p<i;p++){let{cell:f,startRow:h}=c[p];if(h+f.__rowSpan-1<=l){let m=c[p].cell.__headerState,_=zx(m,Ge.COLUMN);d.append(zn(_).append(fe()))}else f.setRowSpan(f.__rowSpan+1)}let u=n.getChildAtIndex(l);We(u)||ie(256),u.insertAfter(d),a=d}else{let l=s,c=o[l],d=Os();for(let p=0;p<i;p++){let{cell:f,startRow:h}=c[p];if(h===l){let m=c[p].cell.__headerState,_=zx(m,Ge.COLUMN);d.append(zn(_).append(fe()))}else f.setRowSpan(f.__rowSpan+1)}let u=n.getChildAtIndex(l);We(u)||ie(257),u.insertBefore(d),a=d}return a}function h8(t,e,n=!0,o,r){let i=t.getChildren(),s=[];for(let a=0;a<i.length;a++){let l=i[a];if(We(l))for(let c=0;c<o;c++){let d=l.getChildren();if(e>=d.length||e<0)throw new Error("Table column target index out of range");let u=d[e];ce(u)||ie(12);let{left:p,right:f}=ZI(u,r),h=Ge.NO_STATUS;(p&&p.hasHeaderState(Ge.ROW)||f&&f.hasHeaderState(Ge.ROW))&&(h|=Ge.ROW);let m=zn(h);m.append(fe()),s.push({newTableCell:m,targetCell:u})}}return s.forEach((({newTableCell:a,targetCell:l})=>{n?l.insertAfter(a):l.insertBefore(a)})),t}function eM(t=!0){let e=$();F(e)||ze(e)||ie(188);let n=e.anchor.getNode(),o=e.focus.getNode(),[r]=Bt(n),[i,,s]=Bt(o),[,a,l]=rn(s,i,r),{startColumn:c}=l,{startColumn:d}=a;return t?Kx(c+r.__colSpan>d+i.__colSpan?r:i,!0):Kx(d<c?i:r,!1)}var g8=eM;function Kx(t,e=!0,n=!0){let[,,o]=Bt(t),[r,i]=rn(o,t,t),s=r.length,{startColumn:a}=i,l=e?a+t.__colSpan-1:a-1,c=o.getFirstChild();We(c)||ie(120);let d=null;function u(h=Ge.NO_STATUS){let m=zn(h).append(fe());return d===null&&(d=m),m}let p=c;e:for(let h=0;h<s;h++){if(h!==0){let E=p.getNextSibling();We(E)||ie(121),p=E}let m=r[h],_=m[l<0?0:l].cell.__headerState,b=zx(_,Ge.ROW);if(l<0){Xx(p,u(b));continue}let{cell:y,startColumn:x,startRow:v}=m[l];if(x+y.__colSpan-1<=l){let E=y,C=v,k=l;for(;C!==h&&E.__rowSpan>1;){if(k-=y.__colSpan,!(k>=0)){p.append(u(b));continue e}{let{cell:T,startRow:w}=m[k];E=T,C=w}}E.insertAfter(u(b))}else y.setColSpan(y.__colSpan+1)}d!==null&&n&&Qc(d);let f=o.getColWidths();if(f){let h=[...f],m=l<0?0:l,_=h[m];h.splice(m,0,_),o.setColWidths(h)}return d}function m8(t,e){let n=t.getChildren();for(let o=0;o<n.length;o++){let r=n[o];if(We(r)){let i=r.getChildren();if(e>=i.length||e<0)throw new Error("Table column target index out of range");i[e].remove()}}return t}function tM(){let t=$();F(t)||ze(t)||ie(188);let[e,n]=t.isBackward()?[t.focus.getNode(),t.anchor.getNode()]:[t.anchor.getNode(),t.focus.getNode()],[o,,r]=Bt(e),[i]=Bt(n),[s,a,l]=rn(r,o,i),{startRow:c}=a,{startRow:d}=l,u=d+i.__rowSpan-1;if(s.length===u-c+1)return void r.remove();let p=s[0].length,f=s[u+1],h=r.getChildAtIndex(u+1);for(let m=u;m>=c;m--){for(let b=p-1;b>=0;b--){let{cell:y,startRow:x,startColumn:v}=s[m][b];if(v===b){if(x<c||x+y.__rowSpan-1>u){let E=Math.max(x,c),C=Math.min(y.__rowSpan+x-1,u),k=E<=C?C-E+1:0;y.setRowSpan(y.__rowSpan-k)}if(x>=c&&x+y.__rowSpan-1>u&&m===u){h===null&&ie(122);let E=null;for(let C=0;C<b;C++){let k=f[C],T=k.cell;k.startRow===m+1&&(E=T),T.__colSpan>1&&(C+=T.__colSpan-1)}E===null?Xx(h,y):E.insertAfter(y)}}}let _=r.getChildAtIndex(m);We(_)||ie(206,String(m)),_.remove()}if(f!==void 0){let{cell:m}=f[0];Qc(m)}else{let m=s[c-1],{cell:_}=m[0];Qc(_)}}var _8=tM;function nM(){let t=$();F(t)||ze(t)||ie(188);let e=t.anchor.getNode(),n=t.focus.getNode(),[o,,r]=Bt(e),[i]=Bt(n),[s,a,l]=rn(r,o,i),{startColumn:c}=a,{startRow:d,startColumn:u}=l,p=Math.min(c,u),f=Math.max(c+o.__colSpan-1,u+i.__colSpan-1),h=f-p+1;if(s[0].length===f-p+1)return r.selectPrevious(),void r.remove();let m=s.length;for(let x=0;x<m;x++)for(let v=p;v<=f;v++){let{cell:E,startColumn:C}=s[x][v];if(C<p){if(v===p){let k=p-C;E.setColSpan(E.__colSpan-Math.min(h,E.__colSpan-k))}}else if(C+E.__colSpan-1>f){if(v===f){let k=f-C+1;E.setColSpan(E.__colSpan-k)}}else E.remove()}let _=s[d],b=c>u?_[c+o.__colSpan]:_[u+i.__colSpan];if(b!==void 0){let{cell:x}=b;Qc(x)}else{let x=u<c?_[u-1]:_[c-1],{cell:v}=x;Qc(v)}let y=r.getColWidths();if(y){let x=[...y];x.splice(p,h),r.setColWidths(x)}}var b8=nM;function Qc(t){let e=t.getFirstDescendant();e==null?t.selectStart():e.getParentOrThrow().selectStart()}function Xx(t,e){let n=t.getFirstChild();n!==null?n.insertBefore(e):t.append(e)}function oM(t){if(t.length===0)return null;let e=Mf(t[0]),[n]=zr(e,null,null),o=1/0,r=-1/0,i=1/0,s=-1/0,a=new Set;for(let f of n)for(let h of f){if(!h||!h.cell)continue;let m=h.cell.getKey();if(!a.has(m)&&t.some((_=>_.is(h.cell)))){a.add(m);let _=h.startRow,b=h.startColumn,y=h.cell.__rowSpan||1,x=h.cell.__colSpan||1;o=Math.min(o,_),r=Math.max(r,_+y-1),i=Math.min(i,b),s=Math.max(s,b+x-1)}}if(o===1/0||i===1/0)return null;let l=r-o+1,c=s-i+1,d=n[o][i];if(!d.cell)return null;let u=d.cell;u.setColSpan(c),u.setRowSpan(l);let p=new Set([u.getKey()]);for(let f=o;f<=r;f++)for(let h=i;h<=s;h++){let m=n[f][h];if(!m.cell)continue;let _=m.cell,b=_.getKey();p.has(b)||(p.add(b),y8(_)||u.append(..._.getChildren()),_.remove())}return u.getChildrenSize()===0&&u.append(fe()),u}function y8(t){if(t.getChildrenSize()!==1)return!1;let e=t.getFirstChildOrThrow();return!(!qt(e)||!e.isEmpty())}function x8(){let t=$();F(t)||ze(t)||ie(188);let e=t.anchor.getNode(),n=le(e,ce);return ce(n)||ie(148),rM(n)}function rM(t){let[e,n,o]=Bt(t),r=e.__colSpan,i=e.__rowSpan;if(r===1&&i===1)return;let[s,a]=rn(o,e,e),{startColumn:l,startRow:c}=a,d=e.__headerState&Ge.COLUMN,u=Array.from({length:r},((h,m)=>{let _=d;for(let b=0;_!==0&&b<s.length;b++)_&=s[b][m+l].cell.__headerState;return _})),p=e.__headerState&Ge.ROW,f=Array.from({length:i},((h,m)=>{let _=p;for(let b=0;_!==0&&b<s[0].length;b++)_&=s[m+c][b].cell.__headerState;return _}));if(r>1){for(let h=1;h<r;h++)e.insertAfter(zn(u[h]|f[0]).append(fe()));e.setColSpan(1)}if(i>1){let h;for(let m=1;m<i;m++){let _=c+m,b=s[_];h=(h||n).getNextSibling(),We(h)||ie(125);let y=null;for(let x=0;x<l;x++){let v=b[x],E=v.cell;v.startRow===_&&(y=E),E.__colSpan>1&&(x+=E.__colSpan-1)}if(y===null)for(let x=r-1;x>=0;x--)Xx(h,zn(u[x]|f[m]).append(fe()));else for(let x=r-1;x>=0;x--)y.insertAfter(zn(u[x]|f[m]).append(fe()))}e.setRowSpan(1)}}function rn(t,e,n){let[o,r,i]=zr(t,e,n);return r===null&&ie(207),i===null&&ie(208),[o,r,i]}function zr(t,e,n){let o=[],r=null,i=null;function s(l){let c=o[l];return c===void 0&&(o[l]=c=[]),c}let a=t.getChildren();for(let l=0;l<a.length;l++){let c=a[l];We(c)||ie(209);let d=s(l);for(let u=c.getFirstChild(),p=0;u!=null;u=u.getNextSibling()){for(ce(u)||ie(147);d[p]!==void 0;)p++;let f={cell:u,startColumn:p,startRow:l},{__rowSpan:h,__colSpan:m}=u;for(let _=0;_<h&&!(l+_>=a.length);_++){let b=s(l+_);for(let y=0;y<m;y++)b[p+y]=f}e!==null&&r===null&&e.is(u)&&(r=f),n!==null&&i===null&&n.is(u)&&(i=f)}}return[o,r,i]}function Bt(t){let e;if(t instanceof Di)e=t;else if("__type"in t){let r=le(t,ce);ce(r)||ie(148),e=r}else{let r=le(t.getNode(),ce);ce(r)||ie(148),e=r}let n=e.getParent();We(n)||ie(149);let o=n.getParent();return rt(o)||ie(210),[e,n,o]}function Nf(t,e,n){let o,r=Math.min(e.startColumn,n.startColumn),i=Math.min(e.startRow,n.startRow),s=Math.max(e.startColumn+e.cell.__colSpan-1,n.startColumn+n.cell.__colSpan-1),a=Math.max(e.startRow+e.cell.__rowSpan-1,n.startRow+n.cell.__rowSpan-1);do{o=!1;for(let l=0;l<t.length;l++)for(let c=0;c<t[0].length;c++){let d=t[l][c];if(!d)continue;let u=d.startColumn+d.cell.__colSpan-1,p=d.startRow+d.cell.__rowSpan-1,f=d.startColumn<=s&&u>=r,h=d.startRow<=a&&p>=i;if(f&&h){let m=Math.min(r,d.startColumn),_=Math.max(s,u),b=Math.min(i,d.startRow),y=Math.max(a,p);m===r&&_===s&&b===i&&y===a||(r=m,s=_,i=b,a=y,o=!0)}}}while(o);return{maxColumn:s,maxRow:a,minColumn:r,minRow:i}}function Ux(t){let[e,,n]=Bt(t),o=n.getChildren(),r=o.length,i=o[0].getChildren().length,s=new Array(r);for(let a=0;a<r;a++)s[a]=new Array(i);for(let a=0;a<r;a++){let l=o[a].getChildren(),c=0;for(let d=0;d<l.length;d++){for(;s[a][c];)c++;let u=l[d],p=u.__rowSpan||1,f=u.__colSpan||1;for(let h=0;h<p;h++)for(let m=0;m<f;m++)s[a+h][c+m]=u;if(e===u)return{colSpan:f,columnIndex:c,rowIndex:a,rowSpan:p};c+=f}}return null}function jI(t){let[[e,n,o,r],[i,s,a,l]]=["anchor","focus"].map((c=>{let d=t[c].getNode(),u=le(d,ce);ce(u)||ie(238,c,d.getKey(),d.getType());let p=u.getParent();We(p)||ie(239,c);let f=p.getParent();return rt(f)||ie(240,c),[d,u,p,f]}));return r.is(l)||ie(241),{anchorCell:n,anchorNode:e,anchorRow:o,anchorTable:r,focusCell:s,focusNode:i,focusRow:a,focusTable:l}}var Df=class t{constructor(e,n,o){this.anchor=n,this.focus=o,n._selection=this,o._selection=this,this._cachedNodes=null,this.dirty=!1,this.tableKey=e}getStartEndPoints(){return[this.anchor,this.focus]}isValid(){return this.tableKey!=="root"&&this.anchor.key!=="root"&&this.anchor.type==="element"&&this.focus.key!=="root"&&this.focus.type==="element"}isBackward(){return this.focus.isBefore(this.anchor)}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){return ze(e)&&this.tableKey===e.tableKey&&this.anchor.is(e.anchor)&&this.focus.is(e.focus)}set(e,n,o){this.dirty=this.dirty||e!==this.tableKey||n!==this.anchor.key||o!==this.focus.key,this.tableKey=e,this.anchor.key=n,this.focus.key=o,this._cachedNodes=null}clone(){return new t(this.tableKey,Go(this.anchor.key,this.anchor.offset,this.anchor.type),Go(this.focus.key,this.focus.offset,this.focus.type))}isCollapsed(){return!1}extract(){return this.getNodes()}insertRawText(e){}insertText(){}hasFormat(e){let n=0;this.getNodes().filter(ce).forEach((r=>{let i=r.getFirstChild();qt(i)&&(n|=i.getTextFormat())}));let o=CD[e];return!!(n&o)}insertNodes(e){let n=this.focus.getNode();G(n)||ie(151),Lr(n.select(0,n.getChildrenSize())).insertNodes(e)}getShape(){let{anchorCell:e,focusCell:n}=jI(this),o=Ux(e);o===null&&ie(153);let r=Ux(n);r===null&&ie(155);let i=Math.min(o.columnIndex,r.columnIndex),s=Math.max(o.columnIndex+o.colSpan-1,r.columnIndex+r.colSpan-1),a=Math.min(o.rowIndex,r.rowIndex),l=Math.max(o.rowIndex+o.rowSpan-1,r.rowIndex+r.rowSpan-1);return{fromX:Math.min(i,s),fromY:Math.min(a,l),toX:Math.max(i,s),toY:Math.max(a,l)}}getNodes(){if(!this.isValid())return[];let e=this._cachedNodes;if(e!==null)return e;let{anchorTable:n,anchorCell:o,focusCell:r}=jI(this),i=r.getParents()[1];if(i!==n){if(n.isParentOf(r)){let _=i.getParent();_==null&&ie(159),this.set(this.tableKey,r.getKey(),_.getKey())}else{let _=n.getParent();_==null&&ie(158),this.set(this.tableKey,_.getKey(),r.getKey())}return this.getNodes()}let[s,a,l]=rn(n,o,r),{minColumn:c,maxColumn:d,minRow:u,maxRow:p}=Nf(s,a,l),f=new Map([[n.getKey(),n]]),h=null;for(let _=u;_<=p;_++)for(let b=c;b<=d;b++){let{cell:y}=s[_][b],x=y.getParent();We(x)||ie(160),x!==h&&(f.set(x.getKey(),x),h=x),f.has(y.getKey())||v8(y,(v=>{f.set(v.getKey(),v)}))}let m=Array.from(f.values());return DD()||(this._cachedNodes=m),m}getTextContent(){let e=this.getNodes().filter((o=>ce(o))),n="";for(let o=0;o<e.length;o++){let r=e[o],i=r.__parent,s=(e[o+1]||{}).__parent;n+=r.getTextContent()+(s!==i?`
|
|
119
|
-
`:" ")}return n}};function ze(t){return t instanceof Df}function Zx(){let t=Go("root",0,"element"),e=Go("root",0,"element");return new Df("root",t,e)}function iM(t,e,n){t.getKey(),e.getKey(),n.getKey();let o=$(),r=ze(o)?o.clone():Zx();return r.set(t.getKey(),e.getKey(),n.getKey()),r}function v8(t,e){let n=[[t]];for(let o=n.at(-1);o!==void 0&&n.length>0;o=n.at(-1)){let r=o.pop();r===void 0?n.pop():e(r)!==!1&&G(r)&&n.push(r.getChildren())}}function Qx(t,e=_s()){let n=St(t);rt(n)||ie(231,t);let o=Oi(n,e.getElementByKey(t));return o===null&&ie(232,t),{tableElement:o,tableNode:n}}var Of=class{constructor(e,n){this.isHighlightingCells=!1,this.anchorX=-1,this.anchorY=-1,this.focusX=-1,this.focusY=-1,this.listenersToRemove=new Set,this.tableNodeKey=n,this.editor=e,this.table={columns:0,domRows:[],rows:0},this.tableSelection=null,this.anchorCellNodeKey=null,this.focusCellNodeKey=null,this.anchorCell=null,this.focusCell=null,this.hasHijackedSelectionStyles=!1,this.isSelecting=!1,this.pointerType=null,this.shouldCheckSelection=!1,this.abortController=new AbortController,this.listenerOptions={signal:this.abortController.signal},this.nextFocus=null,this.trackTable()}getTable(){return this.table}removeListeners(){this.abortController.abort("removeListeners"),Array.from(this.listenersToRemove).forEach((e=>e())),this.listenersToRemove.clear()}$lookup(){return Qx(this.tableNodeKey,this.editor)}trackTable(){let e=new MutationObserver((n=>{this.editor.getEditorState().read((()=>{let o=!1;for(let s=0;s<n.length;s++){let a=n[s].target.nodeName;if(a==="TABLE"||a==="TBODY"||a==="THEAD"||a==="TR"){o=!0;break}}if(!o)return;let{tableNode:r,tableElement:i}=this.$lookup();this.table=cl(r,i)}),{editor:this.editor})}));this.editor.getEditorState().read((()=>{let{tableNode:n,tableElement:o}=this.$lookup();this.table=cl(n,o),e.observe(o,{attributes:!0,childList:!0,subtree:!0})}),{editor:this.editor})}$clearHighlight(){let e=this.editor;this.isHighlightingCells=!1,this.anchorX=-1,this.anchorY=-1,this.focusX=-1,this.focusY=-1,this.tableSelection=null,this.anchorCellNodeKey=null,this.focusCellNodeKey=null,this.anchorCell=null,this.focusCell=null,this.hasHijackedSelectionStyles=!1,this.$enableHighlightStyle();let{tableNode:n,tableElement:o}=this.$lookup();Tf(e,cl(n,o),null),$()!==null&&(gt(null),e.dispatchCommand(cn,void 0))}$enableHighlightStyle(){let e=this.editor,{tableElement:n}=this.$lookup();Fn(n,e._config.theme.tableSelection),n.classList.remove("disable-selection"),this.hasHijackedSelectionStyles=!1}$disableHighlightStyle(){let{tableElement:e}=this.$lookup();Ve(e,this.editor._config.theme.tableSelection),this.hasHijackedSelectionStyles=!0}$updateTableTableSelection(e){if(e!==null){e.tableKey!==this.tableNodeKey&&ie(233,e.tableKey,this.tableNodeKey);let n=this.editor;this.tableSelection=e,this.isHighlightingCells=!0,this.$disableHighlightStyle(),this.updateDOMSelection(),Tf(n,this.table,this.tableSelection)}else this.$clearHighlight()}setShouldCheckSelection(){this.shouldCheckSelection=!0}getAndClearShouldCheckSelection(){return!!this.shouldCheckSelection&&(this.shouldCheckSelection=!1,!0)}setNextFocus(e){this.nextFocus=e}getAndClearNextFocus(){let{nextFocus:e}=this;return e!==null&&(this.nextFocus=null),e}updateDOMSelection(){if(this.anchorCell!==null&&this.focusCell!==null){let e=Jn(this.editor._window);e&&e.rangeCount>0&&e.removeAllRanges()}}$setFocusCellForSelection(e,n=!1){let o=this.editor,{tableNode:r}=this.$lookup(),i=e.x,s=e.y;if(this.focusCell=e,this.isHighlightingCells||this.anchorX===i&&this.anchorY===s&&!n){if(i===this.focusX&&s===this.focusY)return!1}else this.isHighlightingCells=!0,this.$disableHighlightStyle();if(this.focusX=i,this.focusY=s,this.isHighlightingCells){let a=Wx(r,e.elem);if(this.tableSelection!=null&&this.anchorCellNodeKey!=null&&a!==null)return this.focusCellNodeKey=a.getKey(),this.tableSelection=iM(r,this.$getAnchorTableCellOrThrow(),a),gt(this.tableSelection),o.dispatchCommand(cn,void 0),Tf(o,this.table,this.tableSelection),!0}return!1}$getAnchorTableCell(){return this.anchorCellNodeKey?St(this.anchorCellNodeKey):null}$getAnchorTableCellOrThrow(){let e=this.$getAnchorTableCell();return e===null&&ie(234),e}$getFocusTableCell(){return this.focusCellNodeKey?St(this.focusCellNodeKey):null}$getFocusTableCellOrThrow(){let e=this.$getFocusTableCell();return e===null&&ie(235),e}$setAnchorCellForSelection(e){this.isHighlightingCells=!1,this.anchorCell=e,this.anchorX=e.x,this.anchorY=e.y;let{tableNode:n}=this.$lookup(),o=Wx(n,e.elem);if(o!==null){let r=o.getKey();this.tableSelection=this.tableSelection!=null?this.tableSelection.clone():Zx(),this.anchorCellNodeKey=r}}$formatCells(e){let n=$();ze(n)||ie(236);let o=Yo(),r=o.anchor,i=o.focus,s=n.getNodes().filter(ce);s.length>0||ie(237);let a=s[0].getFirstChild(),l=qt(a)?a.getFormatFlags(e,null):null;s.forEach((c=>{r.set(c.getKey(),0,"element"),i.set(c.getKey(),c.getChildrenSize(),"element"),o.formatText(e,l)})),gt(n),this.editor.dispatchCommand(cn,void 0)}$clearText(){let{editor:e}=this,n=St(this.tableNodeKey);if(!rt(n))throw new Error("Expected TableNode.");let o=$();ze(o)||ie(253);let r=o.getNodes().filter(ce),i=n.getFirstChild(),s=n.getLastChild();if(r.length>0&&i!==null&&s!==null&&We(i)&&We(s)&&r[0]===i.getFirstChild()&&r[r.length-1]===s.getLastChild()){n.selectPrevious();let a=n.getParent();return n.remove(),void(qo(a)&&a.isEmpty()&&e.dispatchCommand(vi,void 0))}r.forEach((a=>{if(G(a)){let l=fe(),c=vt();l.append(c),a.append(l),a.getChildren().forEach((d=>{d!==l&&d.remove()}))}})),Tf(e,this.table,null),gt(null),e.dispatchCommand(cn,void 0)}},jx="__lexicalTableSelection",C8=t=>!(1&~t.buttons);function al(t){return vs(t)&&t.nodeName==="TABLE"}function Oi(t,e){if(!e)return e;let n=al(e)?e:t.getDOMSlot(e).element;return n.nodeName!=="TABLE"&&ie(245,e.nodeName),n}function ev(t){return t._window}function Zc(t,e){for(let n=e,o=null;n!==null;n=n.getParent()){if(t.is(n))return o;ce(n)&&(o=n)}return null}var E8=[[Rr,"down"],[So,"up"],[qa,"backward"],[qp,"forward"]],w8=[Gp,Pc,Va],T8=[Jp,Xp];function sM(t,e,n,o){let r=n.getRootElement(),i=ev(n);r!==null&&i!==null||ie(246);let s=new Of(n,t.getKey()),a=Oi(t,e);(function(f,h){Vx(f)!==null&&ie(205),f[jx]=h})(a,s),s.listenersToRemove.add((()=>(function(f,h){Vx(f)===h&&delete f[jx]})(a,s)));let l=f=>{if(s.pointerType=f.pointerType,f.button!==0||!Ti(f.target)||!i)return;let h=ed(f.target);h!==null&&n.update((()=>{let m=Ar();if(UI&&f.shiftKey&&or(m,t)&&(F(m)||ze(m))){let _=m.anchor.getNode(),b=Zc(t,m.anchor.getNode());b?(s.$setAnchorCellForSelection(Ns(s,b)),s.$setFocusCellForSelection(h),$r(f)):(t.isBefore(_)?t.selectStart():t.selectEnd()).anchor.set(m.anchor.key,m.anchor.offset,m.anchor.type)}else f.pointerType!=="touch"&&s.$setAnchorCellForSelection(h)})),(()=>{if(s.isSelecting)return;let m=()=>{s.isSelecting=!1,i.removeEventListener("pointerup",m),i.removeEventListener("pointermove",_)},_=b=>{if(!C8(b)&&s.isSelecting)return s.isSelecting=!1,i.removeEventListener("pointerup",m),void i.removeEventListener("pointermove",_);if(!Ti(b.target))return;let y=null,x=!(UI||a.contains(b.target));if(x)y=VI(a,b.target);else for(let v of document.elementsFromPoint(b.clientX,b.clientY))if(y=VI(a,v),y)break;!y||s.focusCell!==null&&y.elem===s.focusCell.elem||(s.setNextFocus({focusCell:y,override:x}),n.dispatchCommand(cn,void 0))};s.isSelecting=!0,i.addEventListener("pointerup",m,s.listenerOptions),i.addEventListener("pointermove",_,s.listenerOptions)})()};a.addEventListener("pointerdown",l,s.listenerOptions),s.listenersToRemove.add((()=>{a.removeEventListener("pointerdown",l)}));let c=f=>{f.detail>=3&&Ti(f.target)&&ed(f.target)!==null&&f.preventDefault()};a.addEventListener("mousedown",c,s.listenerOptions),s.listenersToRemove.add((()=>{a.removeEventListener("mousedown",c)}));let d=f=>{let h=f.target;f.button===0&&Ti(h)&&n.update((()=>{let m=$();ze(m)&&m.tableKey===s.tableNodeKey&&r.contains(h)&&s.$clearHighlight()}))};i.addEventListener("pointerdown",d,s.listenerOptions),s.listenersToRemove.add((()=>{i.removeEventListener("pointerdown",d)}));for(let[f,h]of E8)s.listenersToRemove.add(n.registerCommand(f,(m=>cM(n,m,h,t,s)),xi));s.listenersToRemove.add(n.registerCommand(Ci,(f=>{let h=$();if(ze(h)){let m=Zc(t,h.focus.getNode());if(m!==null)return $r(f),m.selectEnd(),!0}return!1}),xi));let u=f=>()=>{let h=$();if(!or(h,t))return!1;if(ze(h))return s.$clearText(),!0;if(F(h)){if(!ce(Zc(t,h.anchor.getNode())))return!1;let m=h.anchor.getNode(),_=h.focus.getNode(),b=t.isParentOf(m),y=t.isParentOf(_);if(b&&!y||y&&!b)return s.$clearText(),!0;let x=le(h.anchor.getNode(),(E=>G(E))),v=x&&le(x,(E=>G(E)&&ce(E.getParent())));if(!G(v)||!G(x))return!1;if(f===Pc&&v.getPreviousSibling()===null)return!0}return!1};for(let f of w8)s.listenersToRemove.add(n.registerCommand(f,u(f),Ct));let p=f=>{let h=$();if(!ze(h)&&!F(h))return!1;let m=t.isParentOf(h.anchor.getNode());if(m!==t.isParentOf(h.focus.getNode())){let _=m?"anchor":"focus",b=m?"focus":"anchor",{key:y,offset:x,type:v}=h[b];return t[h[_].isBefore(h[b])?"selectPrevious":"selectNext"]()[b].set(y,x,v),!1}return!!or(h,t)&&!!ze(h)&&(f&&(f.preventDefault(),f.stopPropagation()),s.$clearText(),!0)};for(let f of T8)s.listenersToRemove.add(n.registerCommand(f,p,Ct));return s.listenersToRemove.add(n.registerCommand(Wp,(f=>{let h=$();if(h){if(!ze(h)&&!F(h))return!1;Yc(n,Xn(f,ClipboardEvent)?f:null,OI(h));let m=p(f);return F(h)?(h.removeText(),!0):m}return!1}),Ct)),s.listenersToRemove.add(n.registerCommand(ot,(f=>{let h=$();if(!or(h,t))return!1;if(ze(h))return s.$formatCells(f),!0;if(F(h)){let m=le(h.anchor.getNode(),(_=>ce(_)));if(!ce(m))return!1}return!1}),Ct)),s.listenersToRemove.add(n.registerCommand(Yp,(f=>{let h=$();if(!ze(h)||!or(h,t))return!1;let m=h.anchor.getNode(),_=h.focus.getNode();if(!ce(m)||!ce(_))return!1;if((function(w,S){if(ze(w)){let N=w.anchor.getNode(),D=w.focus.getNode();if(S&&N&&D){let[O]=rn(S,N,D);return N.getKey()===O[0][0].cell.getKey()&&D.getKey()===O[O.length-1].at(-1).cell.getKey()}}return!1})(h,t))return t.setFormat(f),!0;let[b,y,x]=rn(t,m,_),v=Math.max(y.startRow+y.cell.__rowSpan-1,x.startRow+x.cell.__rowSpan-1),E=Math.max(y.startColumn+y.cell.__colSpan-1,x.startColumn+x.cell.__colSpan-1),C=Math.min(y.startRow,x.startRow),k=Math.min(y.startColumn,x.startColumn),T=new Set;for(let w=C;w<=v;w++)for(let S=k;S<=E;S++){let N=b[w][S].cell;if(T.has(N))continue;T.add(N),N.setFormat(f);let D=N.getChildren();for(let O=0;O<D.length;O++){let M=D[O];G(M)&&!M.isInline()&&M.setFormat(f)}}return!0}),Ct)),s.listenersToRemove.add(n.registerCommand(jp,(f=>{let h=$();if(!or(h,t))return!1;if(ze(h))return s.$clearHighlight(),!1;if(F(h)){let m=le(h.anchor.getNode(),(_=>ce(_)));if(!ce(m))return!1;if(typeof f=="string"){let _=YI(n,h,t);if(_)return GI(_,t,[vt(f)]),!0}}return!1}),Ct)),o&&s.listenersToRemove.add(n.registerCommand(Ei,(f=>{let h=$();if(!F(h)||!h.isCollapsed()||!or(h,t))return!1;let m=ll(h.anchor.getNode());return!(m===null||!t.is(Ds(m)))&&($r(f),(function(_,b){let y=b==="next"?"getNextSibling":"getPreviousSibling",x=b==="next"?"getFirstChild":"getLastChild",v=_[y]();if(G(v))return v.selectEnd();let E=le(_,We);E===null&&ie(247);for(let k=E[y]();We(k);k=k[y]()){let T=k[x]();if(G(T))return T.selectEnd()}let C=le(E,rt);C===null&&ie(248),b==="next"?C.selectNext():C.selectPrevious()})(m,f.shiftKey?"previous":"next"),!0)}),Ct)),s.listenersToRemove.add(n.registerCommand(fD,(f=>t.isSelected()),xi)),s.listenersToRemove.add(n.registerCommand(Bc,((f,h)=>{if(n!==h)return!1;let{nodes:m,selection:_}=f,b=_.getStartEndPoints(),y=ze(_),x=F(_)&&le(_.anchor.getNode(),(ye=>ce(ye)))!==null&&le(_.focus.getNode(),(ye=>ce(ye)))!==null||y;if(m.length!==1||!rt(m[0])||!x||b===null)return!1;let[v,E]=b,[C,k,T]=Bt(v),w=le(E.getNode(),(ye=>ce(ye)));if(!(ce(C)&&ce(w)&&We(k)&&rt(T)))return!1;let S=m[0],[N,D,O]=rn(T,C,w),[M]=zr(S,null,null),I=N.length,L=I>0?N[0].length:0,K=D.startRow,W=D.startColumn,q=M.length,B=q>0?M[0].length:0;if(y){let ye=Nf(N,D,O),Xe=ye.maxRow-ye.minRow+1,st=ye.maxColumn-ye.minColumn+1;K=ye.minRow,W=ye.minColumn,q=Math.min(q,Xe),B=Math.min(B,st)}let se=!1,me=Math.min(I,K+q)-1,_t=Math.min(L,W+B)-1,Zt=new Set;for(let ye=K;ye<=me;ye++)for(let Xe=W;Xe<=_t;Xe++){let st=N[ye][Xe];Zt.has(st.cell.getKey())||st.cell.__rowSpan===1&&st.cell.__colSpan===1||(rM(st.cell),Zt.add(st.cell.getKey()),se=!0)}let[ut]=zr(T.getWritable(),null,null),bt=q-I+K;for(let ye=0;ye<bt;ye++)Hx(ut[I-1][0].cell);let sn=B-L+W;for(let ye=0;ye<sn;ye++)Kx(ut[0][L-1].cell,!0,!1);[ut]=zr(T.getWritable(),null,null);for(let ye=K;ye<K+q;ye++)for(let Xe=W;Xe<W+B;Xe++){let st=ye-K,_l=Xe-W,$t=M[st][_l];if($t.startRow!==st||$t.startColumn!==_l)continue;let wn=$t.cell;if(wn.__rowSpan!==1||wn.__colSpan!==1){let eo=[],id=Math.min(ye+wn.__rowSpan,K+q)-1,H=Math.min(Xe+wn.__colSpan,W+B)-1;for(let ne=ye;ne<=id;ne++)for(let pe=Xe;pe<=H;pe++){let re=ut[ne][pe];eo.push(re.cell)}oM(eo),se=!0}let{cell:bl}=ut[ye][Xe],ir=bl.getChildren();wn.getChildren().forEach((eo=>{Q(eo)&&fe().append(eo),bl.append(eo)})),ir.forEach((eo=>eo.remove()))}if(y&&se){let[ye]=zr(T.getWritable(),null,null);ye[D.startRow][D.startColumn].cell.selectEnd()}return!0}),Ct)),s.listenersToRemove.add(n.registerCommand(cn,(()=>{let f=$(),h=Ar(),m=s.getAndClearNextFocus();if(m!==null){let{focusCell:_}=m;if(ze(f)&&f.tableKey===s.tableNodeKey)return(_.x!==s.focusX||_.y!==s.focusY)&&(s.$setFocusCellForSelection(_),!0);if(_!==s.anchorCell&&or(f,t))return s.$setFocusCellForSelection(_),!0}if(s.getAndClearShouldCheckSelection()&&F(h)&&F(f)&&f.isCollapsed()){let _=f.anchor.getNode(),b=t.getFirstChild(),y=ll(_);if(y!==null&&We(b)){let x=b.getFirstChild();if(ce(x)&&t.is(le(y,(v=>v.is(t)||v.is(x)))))return x.selectStart(),!0}}if(F(f)){let{anchor:_,focus:b}=f,y=_.getNode(),x=b.getNode(),v=ll(y),E=ll(x),C=!(!v||!t.is(Ds(v))),k=!(!E||!t.is(Ds(E))),T=C!==k,w=C&&k,S=f.isBackward();if(T){let N=f.clone();if(k){let[D]=rn(t,E,E),O=D[0][0].cell,M=D[D.length-1].at(-1).cell;N.focus.set(S?O.getKey():M.getKey(),S?O.getChildrenSize():M.getChildrenSize(),"element")}else if(C){let[D]=rn(t,v,v),O=D[0][0].cell,M=D[D.length-1].at(-1).cell;N.anchor.set(S?M.getKey():O.getKey(),S?M.getChildrenSize():0,"element")}gt(N),WI(n,s)}else if(w&&(v.is(E)||(s.$setAnchorCellForSelection(Ns(s,v)),s.$setFocusCellForSelection(Ns(s,E),!0)),s.pointerType==="touch"&&s.isSelecting&&f.isCollapsed()&&F(h)&&h.isCollapsed())){let N=ll(h.anchor.getNode());N&&!N.is(E)&&(s.$setAnchorCellForSelection(Ns(s,N)),s.$setFocusCellForSelection(Ns(s,E),!0),s.pointerType=null)}}else if(f&&ze(f)&&f.is(h)&&f.tableKey===t.getKey()){let _=Jn(i);if(_&&_.anchorNode&&_.focusNode){let b=on(_.focusNode),y=b&&!t.isParentOf(b),x=on(_.anchorNode),v=x&&t.isParentOf(x);if(y&&v&&_.rangeCount>0){let E=Y1(_,n);E&&(E.anchor.set(t.getKey(),f.isBackward()?t.getChildrenSize():0,"element"),_.removeAllRanges(),gt(E))}}}return f&&!f.is(h)&&(ze(f)||ze(h))&&s.tableSelection&&!s.tableSelection.is(h)?(ze(f)&&f.tableKey===s.tableNodeKey?s.$updateTableTableSelection(f):!ze(f)&&ze(h)&&h.tableKey===s.tableNodeKey&&s.$updateTableTableSelection(null),!1):(s.hasHijackedSelectionStyles&&!t.isSelected()?(function(_,b){b.$enableHighlightStyle(),tv(b.table,(y=>{let x=y.elem;y.highlighted=!1,lM(_,y),x.getAttribute("style")||x.removeAttribute("style")}))})(n,s):!s.hasHijackedSelectionStyles&&t.isSelected()&&WI(n,s),!1)}),Ct)),s.listenersToRemove.add(n.registerCommand(vi,(()=>{let f=$();if(!F(f)||!f.isCollapsed()||!or(f,t))return!1;let h=YI(n,f,t);return!!h&&(GI(h,t),!0)}),Ct)),s}function Vx(t){return t[jx]||null}function ed(t){let e=t;for(;e!=null;){let n=e.nodeName;if(n==="TD"||n==="TH"){let o=e._cell;return o===void 0?null:o}e=e.parentNode}return null}function VI(t,e){if(!t.contains(e))return null;let n=null;for(let o=e;o!=null;o=o.parentNode){if(o===t)return n;let r=o.nodeName;r!=="TD"&&r!=="TH"||(n=o._cell||null)}return null}function cl(t,e){let n=[],o={columns:0,domRows:n,rows:0},r=Oi(t,e).querySelector("tr"),i=0,s=0;for(n.length=0;r!=null;){let a=r.nodeName;if(a==="TD"||a==="TH"){let d={elem:r,hasBackgroundColor:r.style.backgroundColor!=="",highlighted:!1,x:i,y:s};r._cell=d;let u=n[s];u===void 0&&(u=n[s]=[]),u[i]=d}else{let d=r.firstChild;if(d!=null){r=d;continue}}let l=r.nextSibling;if(l!=null){i++,r=l;continue}let c=r.parentNode;if(c!=null){let d=c.nextSibling;if(d==null)break;s++,i=0,r=d}}return o.columns=i+1,o.rows=s+1,o}function Tf(t,e,n){let o=new Set(n?n.getNodes():[]);tv(e,((r,i)=>{let s=r.elem;o.has(i)?(r.highlighted=!0,aM(t,r)):(r.highlighted=!1,lM(t,r),s.getAttribute("style")||s.removeAttribute("style"))}))}function tv(t,e){let{domRows:n}=t;for(let o=0;o<n.length;o++){let r=n[o];if(r)for(let i=0;i<r.length;i++){let s=r[i];if(!s)continue;let a=on(s.elem);a!==null&&e(s,a,{x:i,y:o})}}}function WI(t,e){e.$disableHighlightStyle(),tv(e.table,(n=>{n.highlighted=!0,aM(t,n)}))}var S8=(t,e,n,o,r)=>{let i=r==="forward";switch(r){case"backward":case"forward":return n!==(i?t.table.columns-1:0)?kf(e.getCellNodeFromCordsOrThrow(n+(i?1:-1),o,t.table),i):o!==(i?t.table.rows-1:0)?kf(e.getCellNodeFromCordsOrThrow(i?0:t.table.columns-1,o+(i?1:-1),t.table),i):i?e.selectNext():e.selectPrevious(),!0;case"up":return o!==0?kf(e.getCellNodeFromCordsOrThrow(n,o-1,t.table),!1):e.selectPrevious(),!0;case"down":return o!==t.table.rows-1?kf(e.getCellNodeFromCordsOrThrow(n,o+1,t.table),!0):e.selectNext(),!0;default:return!1}};function Bx(t,e){let n,o;if(e.startColumn===t.minColumn)n="minColumn";else{if(e.startColumn+e.cell.__colSpan-1!==t.maxColumn)return null;n="maxColumn"}if(e.startRow===t.minRow)o="minRow";else{if(e.startRow+e.cell.__rowSpan-1!==t.maxRow)return null;o="maxRow"}return[n,o]}function Sf([t,e]){return[t==="minColumn"?"maxColumn":"minColumn",e==="minRow"?"maxRow":"minRow"]}function sl(t,e,[n,o]){let r=e[o],i=t[r];i===void 0&&ie(250,o,String(r));let s=e[n],a=i[s];return a===void 0&&ie(250,n,String(s)),a}function k8(t,e,n,o,r){let i=Nf(e,n,o),s=(function(C,k){let{minColumn:T,maxColumn:w,minRow:S,maxRow:N}=k,D=1,O=1,M=1,I=1,L=C[S],K=C[N];for(let W=T;W<=w;W++)D=Math.max(D,L[W].cell.__rowSpan),I=Math.max(I,K[W].cell.__rowSpan);for(let W=S;W<=N;W++)O=Math.max(O,C[W][T].cell.__colSpan),M=Math.max(M,C[W][w].cell.__colSpan);return{bottomSpan:I,leftSpan:O,rightSpan:M,topSpan:D}})(e,i),{topSpan:a,leftSpan:l,bottomSpan:c,rightSpan:d}=s,u=(function(C,k){let T=Bx(C,k);return T===null&&ie(249,k.cell.getKey()),T})(i,n),[p,f]=Sf(u),h=i[p],m=i[f];r==="forward"?h+=p==="maxColumn"?1:l:r==="backward"?h-=p==="minColumn"?1:d:r==="down"?m+=f==="maxRow"?1:a:r==="up"&&(m-=f==="minRow"?1:c);let _=e[m];if(_===void 0)return!1;let b=_[h];if(b===void 0)return!1;let[y,x]=(function(C,k,T){let w=Nf(C,k,T),S=Bx(w,k);if(S)return[sl(C,w,S),sl(C,w,Sf(S))];let N=Bx(w,T);if(N)return[sl(C,w,Sf(N)),sl(C,w,N)];let D=["minColumn","minRow"];return[sl(C,w,D),sl(C,w,Sf(D))]})(e,n,b),v=Ns(t,y.cell),E=Ns(t,x.cell);return t.$setAnchorCellForSelection(v),t.$setFocusCellForSelection(E,!0),!0}function or(t,e){if(F(t)||ze(t)){let n=e.isParentOf(t.anchor.getNode()),o=e.isParentOf(t.focus.getNode());return n&&o}return!1}function kf(t,e){e?t.selectStart():t.selectEnd()}function aM(t,e){let n=e.elem,o=t._config.theme;ce(on(n))||ie(131),Ve(n,o.tableCellSelected)}function lM(t,e){let n=e.elem;ce(on(n))||ie(131);let o=t._config.theme;Fn(n,o.tableCellSelected)}function ll(t){let e=le(t,ce);return ce(e)?e:null}function Ds(t){let e=le(t,rt);return rt(e)?e:null}function N8(t,e,n,o,r,i,s){let a=mi(n.focus,r?"previous":"next");if(Bp(a))return!1;let l=a;for(let _ of Lc(a).iterNodeCarets("shadowRoot")){if(!$p(_)||!G(_.origin))return!1;l=_}let c=l.getParentAtCaret();if(!ce(c))return!1;let d=c,u=(function(_){for(let b of Lc(_).iterNodeCarets("root")){let{origin:y}=b;if(ce(y)){if(bi(b))return qn(y,_.direction)}else if(!We(y))break}return null})(xn(d,l.direction)),p=le(d,rt);if(!p||!p.is(i))return!1;let f=t.getElementByKey(d.getKey()),h=ed(f);if(!f||!h)return!1;let m=dM(t,p);if(s.table=m,u)if(o==="extend"){let _=ed(t.getElementByKey(u.origin.getKey()));if(!_)return!1;s.$setAnchorCellForSelection(h),s.$setFocusCellForSelection(_,!0)}else{let _=Jo(u);yi(n.anchor,_),yi(n.focus,_)}else if(o==="extend")s.$setAnchorCellForSelection(h),s.$setFocusCellForSelection(h,!0);else{let _=(function(b){let y=ms(b);return bi(y)?Jo(y):b})(xn(p,a.direction));yi(n.anchor,_),yi(n.focus,_)}return $r(e),!0}function cM(t,e,n,o,r){if((n==="up"||n==="down")&&(function(s){let a=s.getRootElement();return a?a.hasAttribute("aria-controls")&&a.getAttribute("aria-controls")==="typeahead-menu":!1})(t))return!1;let i=$();if(!or(i,o)){if(F(i)){if(n==="backward"){if(i.focus.offset>0)return!1;let s=(function(l){for(let c=l,d=l;d!==null;c=d,d=d.getParent())if(G(d)){if(d!==c&&d.getFirstChild()!==c)return null;if(!d.isInline())return d}return null})(i.focus.getNode());if(!s)return!1;let a=s.getPreviousSibling();return!!rt(a)&&($r(e),e.shiftKey?i.focus.set(a.getParentOrThrow().getKey(),a.getIndexWithinParent(),"element"):a.selectEnd(),!0)}if(e.shiftKey&&(n==="up"||n==="down")){let s=i.focus.getNode();if(!i.isCollapsed()&&(n==="up"&&!i.isBackward()||n==="down"&&i.isBackward())){let a=le(s,(p=>rt(p)));if(ce(a)&&(a=le(a,rt)),a!==o||!a)return!1;let l=n==="down"?a.getNextSibling():a.getPreviousSibling();if(!l)return!1;let c=0;n==="up"&&G(l)&&(c=l.getChildrenSize());let d=l;n==="up"&&G(l)&&(d=l.getLastChild()||l,c=Q(d)?d.getTextContentSize():0);let u=i.clone();return u.focus.set(d.getKey(),c,Q(d)?"text":"element"),gt(u),$r(e),!0}if(Rt(s)){let a=n==="up"?i.getNodes()[i.getNodes().length-1]:i.getNodes()[0];if(a&&Zc(o,a)!==null){let l=o.getFirstDescendant(),c=o.getLastDescendant();if(!l||!c)return!1;let[d]=Bt(l),[u]=Bt(c),p=o.getCordsFromCellNode(d,r.table),f=o.getCordsFromCellNode(u,r.table),h=o.getDOMCellFromCordsOrThrow(p.x,p.y,r.table),m=o.getDOMCellFromCordsOrThrow(f.x,f.y,r.table);return r.$setAnchorCellForSelection(h),r.$setFocusCellForSelection(m,!0),!0}return!1}{let a=le(s,(c=>G(c)&&!c.isInline()));if(ce(a)&&(a=le(a,rt)),!a)return!1;let l=n==="down"?a.getNextSibling():a.getPreviousSibling();if(rt(l)&&r.tableNodeKey===l.getKey()){let c=l.getFirstDescendant(),d=l.getLastDescendant();if(!c||!d)return!1;let[u]=Bt(c),[p]=Bt(d),f=i.clone();return f.focus.set((n==="up"?u:p).getKey(),n==="up"?0:p.getChildrenSize(),"element"),$r(e),gt(f),!0}}}}return n==="down"&&If(t)&&r.setShouldCheckSelection(),!1}if(F(i)){if(n==="backward"||n==="forward")return N8(t,e,i,e.shiftKey?"extend":"move",n==="backward",o,r);if(i.isCollapsed()){let{anchor:s,focus:a}=i,l=le(s.getNode(),ce),c=le(a.getNode(),ce);if(!ce(l)||!l.is(c))return!1;let d=Ds(l);if(d!==o&&d!=null){let b=Oi(d,t.getElementByKey(d.getKey()));if(b!=null)return r.table=cl(d,b),cM(t,e,n,d,r)}let u=t.getElementByKey(l.__key),p=t.getElementByKey(s.key);if(p==null||u==null)return!1;let f;if(s.type==="element")f=p.getBoundingClientRect();else{let b=Jn(ev(t));if(b===null||b.rangeCount===0)return!1;f=b.getRangeAt(0).getBoundingClientRect()}let h=n==="up"?l.getFirstChild():l.getLastChild();if(h==null)return!1;let m=t.getElementByKey(h.__key);if(m==null)return!1;let _=m.getBoundingClientRect();if(n==="up"?_.top>f.top-f.height:f.bottom+f.height>_.bottom){$r(e);let b=o.getCordsFromCellNode(l,r.table);if(!e.shiftKey)return S8(r,o,b.x,b.y,n);{let y=o.getDOMCellFromCordsOrThrow(b.x,b.y,r.table);r.$setAnchorCellForSelection(y),r.$setFocusCellForSelection(y,!0)}return!0}}}else if(ze(i)){let{anchor:s,focus:a}=i,l=le(s.getNode(),ce),c=le(a.getNode(),ce),[d]=i.getNodes();rt(d)||ie(251);let u=Oi(d,t.getElementByKey(d.getKey()));if(!ce(l)||!ce(c)||!rt(d)||u==null)return!1;r.$updateTableTableSelection(i);let p=cl(d,u),f=o.getCordsFromCellNode(l,p),h=o.getDOMCellFromCordsOrThrow(f.x,f.y,p);if(r.$setAnchorCellForSelection(h),$r(e),e.shiftKey){let[m,_,b]=rn(o,l,c);return k8(r,m,_,b,n)}return c.selectEnd(),!0}return!1}function $r(t){t.preventDefault(),t.stopImmediatePropagation(),t.stopPropagation()}function GI(t,e,n){let o=fe();t==="first"?e.insertBefore(o):e.insertAfter(o),o.append(...n||[]),o.selectEnd()}function YI(t,e,n){let o=n.getParent();if(!o)return;let r=Jn(ev(t));if(!r)return;let i=r.anchorNode,s=t.getElementByKey(o.getKey()),a=Oi(n,t.getElementByKey(n.getKey()));if(!i||!s||!a||!s.contains(i)||a.contains(i))return;let l=le(e.anchor.getNode(),(y=>ce(y)));if(!l)return;let c=le(l,(y=>rt(y)));if(!rt(c)||!c.is(n))return;let[d,u]=rn(n,l,l),p=d[0][0],f=d[d.length-1][d[0].length-1],{startRow:h,startColumn:m}=u,_=h===p.startRow&&m===p.startColumn,b=h===f.startRow&&m===f.startColumn;return _?"first":b?"last":void 0}function Ns(t,e){let{tableNode:n}=t.$lookup(),o=n.getCordsFromCellNode(e,t.table);return n.getDOMCellFromCordsOrThrow(o.x,o.y,t.table)}function Wx(t,e,n){return Zc(t,on(e,n))}function qI(t,e,n){if(!e.theme.tableAlignment)return;let o=[],r=[];for(let i of["center","right"]){let s=e.theme.tableAlignment[i];s&&(i===n?r:o).push(s)}Fn(t,...o),Ve(t,...r)}var Gx=new WeakSet;function If(t=_s()){return Gx.has(t)}function D8(t,e){e?Gx.add(t):Gx.delete(t)}var Ii=class t extends Pt{static getType(){return"table"}getColWidths(){return this.getLatest().__colWidths}setColWidths(e){let n=this.getWritable();return n.__colWidths=e,n}static clone(e){return new t(e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__colWidths=e.__colWidths,this.__rowStriping=e.__rowStriping,this.__frozenColumnCount=e.__frozenColumnCount,this.__frozenRowCount=e.__frozenRowCount}static importDOM(){return{table:e=>({conversion:O8,priority:1})}}static importJSON(e){return Af().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setRowStriping(e.rowStriping||!1).setFrozenColumns(e.frozenColumnCount||0).setFrozenRows(e.frozenRowCount||0).setColWidths(e.colWidths)}constructor(e){super(e),this.__rowStriping=!1,this.__frozenColumnCount=0,this.__frozenRowCount=0}exportJSON(){return{...super.exportJSON(),colWidths:this.getColWidths(),frozenColumnCount:this.__frozenColumnCount?this.__frozenColumnCount:void 0,frozenRowCount:this.__frozenRowCount?this.__frozenRowCount:void 0,rowStriping:this.__rowStriping?this.__rowStriping:void 0}}extractWithChild(e,n,o){return o==="html"}getDOMSlot(e){let n=al(e)?e:e.querySelector("table");return al(n)||ie(229),super.getDOMSlot(e).withElement(n).withAfter(n.querySelector("colgroup"))}createDOM(e,n){let o=document.createElement("table");this.__style&&(o.style.cssText=this.__style);let r=document.createElement("colgroup");if(o.appendChild(r),AD(r),Ve(o,e.theme.table),this.updateTableElement(null,o,e),If(n)){let i=document.createElement("div"),s=e.theme.tableScrollableWrapper;return s?Ve(i,s):i.style.cssText="overflow-x: auto;",i.appendChild(o),this.updateTableWrapper(null,i,o,e),i}return o}updateTableWrapper(e,n,o,r){this.__frozenColumnCount!==(e?e.__frozenColumnCount:0)&&(function(i,s,a,l){l>0?(Ve(i,a.theme.tableFrozenColumn),s.setAttribute("data-lexical-frozen-column","true")):(Fn(i,a.theme.tableFrozenColumn),s.removeAttribute("data-lexical-frozen-column"))})(n,o,r,this.__frozenColumnCount),this.__frozenRowCount!==(e?e.__frozenRowCount:0)&&(function(i,s,a,l){l>0?(Ve(i,a.theme.tableFrozenRow),s.setAttribute("data-lexical-frozen-row","true")):(Fn(i,a.theme.tableFrozenRow),s.removeAttribute("data-lexical-frozen-row"))})(n,o,r,this.__frozenRowCount)}updateTableElement(e,n,o){this.__style!==(e?e.__style:"")&&(n.style.cssText=this.__style),this.__rowStriping!==(!!e&&e.__rowStriping)&&(function(r,i,s){s?(Ve(r,i.theme.tableRowStriping),r.setAttribute("data-lexical-row-striping","true")):(Fn(r,i.theme.tableRowStriping),r.removeAttribute("data-lexical-row-striping"))})(n,o,this.__rowStriping),(function(r,i,s,a){let l=r.querySelector("colgroup");if(!l)return;let c=[];for(let d=0;d<s;d++){let u=document.createElement("col"),p=a&&a[d];p&&(u.style.width=`${p}px`),c.push(u)}l.replaceChildren(...c)})(n,0,this.getColumnCount(),this.getColWidths()),qI(n,o,this.getFormatType())}updateDOM(e,n,o){let r=this.getDOMSlot(n).element;return n===r===If()||(Jt(i=n)&&i.nodeName==="DIV"&&this.updateTableWrapper(e,n,r,o),this.updateTableElement(e,r,o),!1);var i}exportDOM(e){let n=super.exportDOM(e),{element:o}=n;return{after:r=>{if(n.after&&(r=n.after(r)),!al(r)&&Jt(r)&&(r=r.querySelector("table")),!al(r))return null;qI(r,e._config,this.getFormatType());let[i]=zr(this,null,null),s=new Map;for(let d of i)for(let u of d){let p=u.cell.getKey();s.has(p)||s.set(p,{colSpan:u.cell.getColSpan(),startColumn:u.startColumn})}let a=new Set;for(let d of r.querySelectorAll(":scope > tr > [data-temporary-table-cell-lexical-key]")){let u=d.getAttribute("data-temporary-table-cell-lexical-key");if(u){let p=s.get(u);if(d.removeAttribute("data-temporary-table-cell-lexical-key"),p){s.delete(u);for(let f=0;f<p.colSpan;f++)a.add(f+p.startColumn)}}}let l=r.querySelector(":scope > colgroup");if(l){let d=Array.from(r.querySelectorAll(":scope > colgroup > col")).filter(((u,p)=>a.has(p)));l.replaceChildren(...d)}let c=r.querySelectorAll(":scope > tr");if(c.length>0){let d=document.createElement("tbody");for(let u of c)d.appendChild(u);r.append(d)}return r},element:!al(o)&&Jt(o)?o.querySelector("table"):o}}canBeEmpty(){return!1}isShadowRoot(){return!0}getCordsFromCellNode(e,n){let{rows:o,domRows:r}=n;for(let i=0;i<o;i++){let s=r[i];if(s!=null)for(let a=0;a<s.length;a++){let l=s[a];if(l==null)continue;let{elem:c}=l,d=Wx(this,c);if(d!==null&&e.is(d))return{x:a,y:i}}}throw new Error("Cell not found in table.")}getDOMCellFromCords(e,n,o){let{domRows:r}=o,i=r[n];if(i==null)return null;let s=i[e<i.length?e:i.length-1];return s??null}getDOMCellFromCordsOrThrow(e,n,o){let r=this.getDOMCellFromCords(e,n,o);if(!r)throw new Error("Cell not found at cords.");return r}getCellNodeFromCords(e,n,o){let r=this.getDOMCellFromCords(e,n,o);if(r==null)return null;let i=on(r.elem);return ce(i)?i:null}getCellNodeFromCordsOrThrow(e,n,o){let r=this.getCellNodeFromCords(e,n,o);if(!r)throw new Error("Node at cords not TableCellNode.");return r}getRowStriping(){return!!this.getLatest().__rowStriping}setRowStriping(e){let n=this.getWritable();return n.__rowStriping=e,n}setFrozenColumns(e){let n=this.getWritable();return n.__frozenColumnCount=e,n}getFrozenColumns(){return this.getLatest().__frozenColumnCount}setFrozenRows(e){let n=this.getWritable();return n.__frozenRowCount=e,n}getFrozenRows(){return this.getLatest().__frozenRowCount}canSelectBefore(){return!0}canIndent(){return!1}getColumnCount(){let e=this.getFirstChild();if(!e)return 0;let n=0;return e.getChildren().forEach((o=>{ce(o)&&(n+=o.getColSpan())})),n}};function dM(t,e){let n=t.getElementByKey(e.getKey());return n===null&&ie(230),cl(e,n)}function O8(t){let e=Af();t.hasAttribute("data-lexical-row-striping")&&e.setRowStriping(!0),t.hasAttribute("data-lexical-frozen-column")&&e.setFrozenColumns(1),t.hasAttribute("data-lexical-frozen-row")&&e.setFrozenRows(1);let n=t.querySelector(":scope > colgroup");if(n){let o=[];for(let r of n.querySelectorAll(":scope > col")){let i=r.style.width||"";if(!Yx.test(i)&&(i=r.getAttribute("width")||"",!/^\d+$/.test(i))){o=void 0;break}o.push(parseFloat(i))}o&&e.setColWidths(o)}return{after:o=>Yy(o,We),node:e}}function Af(){return Tt(new Ii)}function rt(t){return t instanceof Ii}function I8({rows:t,columns:e,includeHeaders:n}){let o=$()||Ar();if(!o||!F(o)||Ds(o.anchor.getNode()))return!1;let r=XI(Number(t),Number(e),n);lf(r);let i=r.getFirstDescendant();return Q(i)&&i.select(),!0}function M8(t){We(t.getParent())?t.isEmpty()&&t.append(fe()):t.remove()}function A8(t){rt(t.getParent())?qy(t,ce):t.remove()}function L8(t){qy(t,We);let[e]=zr(t,null,null),n=e.reduce(((r,i)=>Math.max(r,i.length)),0),o=t.getChildren();for(let r=0;r<e.length;++r){let i=o[r];if(!i)continue;We(i)||ie(254,i.constructor.name,i.getType());let s=e[r].reduce(((a,l)=>l?1+a:a),0);if(s!==n)for(let a=s;a<n;++a){let l=zn();l.append(fe()),i.append(l)}}}function R8(t){if(t.detail<3||!Ti(t.target))return!1;let e=on(t.target);if(e===null)return!1;let n=le(e,(o=>G(o)&&!o.isInline()));return n===null?!1:!!ce(n.getParent())&&(n.select(0),!0)}function P8(t){return t.registerNodeTransform(Di,(e=>{if(e.getColSpan()>1||e.getRowSpan()>1){let[,,n]=Bt(e),[o]=rn(n,e,e),r=o.length,i=o[0].length,s=n.getFirstChild();We(s)||ie(175);let a=[];for(let l=0;l<r;l++){l!==0&&(s=s.getNextSibling(),We(s)||ie(175));let c=null;for(let d=0;d<i;d++){let u=o[l][d],p=u.cell;if(u.startRow===l&&u.startColumn===d)c=p,a.push(p);else if(p.getColSpan()>1||p.getRowSpan()>1){ce(p)||ie(176);let f=zn(p.__headerState);c!==null?c.insertAfter(f):hO(s,f)}}}for(let l of a)l.setColSpan(1),l.setRowSpan(1)}}))}function F8(t,e=!0){let n=new Map,o=(i,s,a)=>{let l=Oi(i,a),c=sM(i,l,t,e);n.set(s,[c,l])},r=t.registerMutationListener(Ii,(i=>{t.getEditorState().read((()=>{for(let[s,a]of i){let l=n.get(s);if(a==="created"||a==="updated"){let{tableNode:c,tableElement:d}=Qx(s);l===void 0?o(c,s,d):d!==l[1]&&(l[0].removeListeners(),n.delete(s),o(c,s,d))}else a==="destroyed"&&l!==void 0&&(l[0].removeListeners(),n.delete(s))}}),{editor:t})}),{skipInitialization:!1});return()=>{r();for(let[,[i]]of n)i.removeListeners()}}function B8(t){return t.hasNodes([Ii])||ie(255),Be(t.registerCommand(JI,I8,Ee),t.registerCommand(Bc,(({nodes:e,selection:n},o)=>t!==o||!F(n)?!1:Ds(n.anchor.getNode())!==null&&e.some(rt)),Ee),t.registerCommand(Xo,R8,Ee),t.registerNodeTransform(Ii,L8),t.registerNodeTransform(dl,A8),t.registerNodeTransform(Di,M8))}var ue=nv,Doe=ue.$computeTableMap,Ooe=ue.$computeTableMapSkipCellCheck,uM=ue.$createTableCellNode,pM=ue.$createTableNode,Ioe=ue.$createTableNodeWithDimensions,fM=ue.$createTableRowNode,Moe=ue.$createTableSelection,Aoe=ue.$createTableSelectionFrom,Loe=ue.$deleteTableColumn,hM=ue.$deleteTableColumnAtSelection,Roe=ue.$deleteTableColumn__EXPERIMENTAL,gM=ue.$deleteTableRowAtSelection,Poe=ue.$deleteTableRow__EXPERIMENTAL,Foe=ue.$findCellNode,Boe=ue.$findTableNode,$oe=ue.$getElementForTableNode,zoe=ue.$getNodeTriplet,Hoe=ue.$getTableAndElementByKey,ov=ue.$getTableCellNodeFromLexicalNode,Koe=ue.$getTableCellNodeRect,Uoe=ue.$getTableColumnIndexFromTableCellNode,td=ue.$getTableNodeFromLexicalNodeOrThrow,joe=ue.$getTableRowIndexFromTableCellNode,Voe=ue.$getTableRowNodeFromTableCellNodeOrThrow,Woe=ue.$insertTableColumn,rv=ue.$insertTableColumnAtSelection,Goe=ue.$insertTableColumn__EXPERIMENTAL,Yoe=ue.$insertTableRow,iv=ue.$insertTableRowAtSelection,qoe=ue.$insertTableRow__EXPERIMENTAL,mM=ue.$isScrollableTablesActive,Do=ue.$isTableCellNode,_M=ue.$isTableNode,po=ue.$isTableRowNode,bM=ue.$isTableSelection,Joe=ue.$mergeCells,Xoe=ue.$removeTableRowAtIndex,Zoe=ue.$unmergeCell,yM=ue.INSERT_TABLE_COMMAND,Cn=ue.TableCellHeaderStates,Lf=ue.TableCellNode,Rf=ue.TableNode,Qoe=ue.TableObserver,xM=ue.TableRowNode,ere=ue.applyTableHandlers,tre=ue.getDOMCellFromTarget,nre=ue.getTableElement,ore=ue.getTableObserverFromTableElement,vM=ue.registerTableCellUnmergeTransform,CM=ue.registerTablePlugin,EM=ue.registerTableSelectionObserver,wM=ue.setScrollableTablesActive;var sv={};Re(sv,{TablePlugin:()=>$8});pt();function $8({hasCellMerge:t=!0,hasCellBackgroundColor:e=!0,hasTabHandler:n=!0,hasHorizontalScroll:o=!1}){let[r]=be();return P((()=>{mM(r)!==o&&(wM(r,o),r.registerNodeTransform(Rf,(()=>{}))())}),[r,o]),P((()=>CM(r)),[r]),P((()=>EM(r,n)),[r,n]),P((()=>{if(!t)return vM(r)}),[r,t]),P((()=>{if(!e)return r.registerNodeTransform(Lf,(i=>{i.getBackgroundColor()!==null&&i.setBackgroundColor(null)}))}),[r,e,t]),null}var z8=sv,TM=z8.TablePlugin;ke();function av(t){return{type:"string",...t}}function SM(t){return{type:"image",...t}}function H8(t){return t}var lv=H8;var NM=new Set(["paragraph","heading","quote","orderedList","unorderedList","table","delimiter"]),kM=40,U8=200,uv="root:openRichTextBlock",pv="root:openRichTextInline";function cre(t,e,n,o={}){let r=(t||"").trim();if(!r)return[];let i={query:r,queryLower:r.toLowerCase(),results:[],types:o},s=[];for(cv(s,i,n,e,"fields",[]);s.length>0&&i.results.length<U8;)s.shift()();return i.results}function cv(t,e,n,o,r,i){if(o)for(let s of n){if(!s.id||s.hidden)continue;let a=o[s.id],l=`${r}.${s.id}`,c=s.label||s.id;t.push(()=>DM(t,e,s,a,l,[...i,c]))}}function DM(t,e,n,o,r,i){if(o!=null)switch(n.type){case"object":{cv(t,e,n.fields||[],o,r,i);return}case"array":{let s=n;(o?._array||[]).forEach((l,c)=>{let d=o?.[l];if(d==null)return;let u=`[${c}]`,p=s.of;t.push(()=>DM(t,e,p,d,`${r}.${l}`,[...i,u]))});return}case"oneof":{let s=n,a=o?._type;if(!a)return;let l=s.types||[],c;if(typeof l[0]=="string"?l.includes(a)&&(c=e.types[a]):c=l.find(d=>d?.name===a),!c)return;cv(t,e,c.fields||[],o,r,[...i.slice(0,-1),`${i.at(-1)} (${a})`]);return}case"string":{typeof o=="string"&&dn(e,o,n.type,r,i);return}case"select":{typeof o=="string"&&dn(e,o,n.type,r,i);return}case"multiselect":{if(Array.isArray(o)){let s=o.filter(a=>typeof a=="string").join(", ");s&&dn(e,s,n.type,r,i)}return}case"number":{typeof o=="number"&&dn(e,String(o),n.type,r,i);return}case"boolean":return;case"date":case"datetime":{typeof o=="string"&&dn(e,o,n.type,r,i);return}case"image":case"file":{if(o&&typeof o=="object"){let s=[];typeof o.alt=="string"&&s.push(o.alt),typeof o.filename=="string"&&s.push(o.filename),typeof o.src=="string"&&s.push(o.src),s.length>0&&dn(e,s.join(" "),n.type,r,i)}return}case"reference":{o&&typeof o=="object"&&typeof o.id=="string"&&dn(e,o.id,n.type,r,i);return}case"references":{if(Array.isArray(o)){let s=o.map(a=>a&&typeof a=="object"?a.id:null).filter(a=>typeof a=="string").join(", ");s&&dn(e,s,n.type,r,i)}return}case"richtext":{OM(e,n,o,r,i);return}default:return}}function OM(t,e,n,o,r){if(!n||!Array.isArray(n.blocks))return;let i=new Map;(e.blockComponents||[]).forEach(a=>{a?.name&&i.set(a.name,a)});let s=-1;n.blocks.forEach(a=>{if(!a?.type)return;if(NM.has(a.type)){MM(t,a,o,r);return}s+=1;let l=s,c={block:{richTextDeepKey:o,blockIndex:l,blockName:a.type}},d=i.get(a.type);if(!d){Pf(t,a.data,o,[...r,`${a.type} [block ${l}]`],c);return}let u=[...r,`${d.label||d.name} [block ${l}]`];dv(t,d.fields||[],a.data||{},o,u,c)})}function dv(t,e,n,o,r,i){for(let s of e){if(!s.id||s.hidden)continue;let a=n?.[s.id];if(a==null)continue;let l=[...r,s.label||s.id];IM(t,s,a,o,l,i)}}function IM(t,e,n,o,r,i){switch(e.type){case"object":{dv(t,e.fields||[],n,o,r,i);return}case"array":{let s=e;(n?._array||[]).forEach((l,c)=>{let d=n?.[l];d!=null&&IM(t,s.of,d,o,[...r,`[${c}]`],i)});return}case"oneof":{let s=e,a=n?._type;if(!a)return;let l=s.types||[],c;typeof l[0]=="string"?l.includes(a)&&(c=t.types[a]):c=l.find(d=>d?.name===a),c&&dv(t,c.fields||[],n,o,[...r.slice(0,-1),`${r.at(-1)} (${a})`],i);return}case"string":case"select":{typeof n=="string"&&dn(t,n,e.type,o,r,i);return}case"multiselect":{if(Array.isArray(n)){let s=n.filter(a=>typeof a=="string").join(", ");s&&dn(t,s,e.type,o,r,i)}return}case"number":{typeof n=="number"&&dn(t,String(n),e.type,o,r,i);return}case"image":case"file":{if(n&&typeof n=="object"){let s=[];typeof n.alt=="string"&&s.push(n.alt),typeof n.filename=="string"&&s.push(n.filename),typeof n.src=="string"&&s.push(n.src),s.length>0&&dn(t,s.join(" "),e.type,o,r,i)}return}case"richtext":{OM(t,e,n,o,r);return}default:return}}function Pf(t,e,n,o,r){if(e!=null){if(typeof e=="string"){dn(t,e,"string",n,o,r);return}if(typeof e=="number"){dn(t,String(e),"number",n,o,r);return}if(Array.isArray(e)){e.forEach((i,s)=>Pf(t,i,n,[...o,`[${s}]`],r));return}if(typeof e=="object")for(let i of Object.keys(e))i.startsWith("_")||Pf(t,e[i],n,[...o,i],r)}}function MM(t,e,n,o){switch(e.type){case"heading":case"paragraph":{let r=RM(e.data?.text);r&&dn(t,r,"richtext",n,[...o,e.type]),LM(t,e.data?.components,n,o);return}case"orderedList":case"unorderedList":{AM(t,e.data?.items,n,[...o,e.type]);return}case"table":{(e.data?.rows||[]).forEach((i,s)=>{(i.cells||[]).forEach((a,l)=>{(a.blocks||[]).forEach(c=>{NM.has(c.type)&&MM(t,c,n,[...o,`table [${s},${l}]`])})})});return}default:return}}function AM(t,e,n,o){e&&e.forEach((r,i)=>{let s=RM(r.content);s&&dn(t,s,"richtext",n,[...o,`[${i}]`]),LM(t,r.components,n,o),AM(t,r.items,n,[...o,`[${i}]`])})}function LM(t,e,n,o){if(e)for(let r of Object.keys(e)){let i=e[r];if(!i?.type)continue;let s={inline:{richTextDeepKey:n,componentId:r,componentName:i.type}};Pf(t,i?.data,n,[...o,`inline:${i.type}`],s)}}function RM(t){return t?t.replace(/<[^>]+>/g," ").replace(/ /g," ").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/\s+/g," ").trim():""}function dn(t,e,n,o,r,i){if(!e||e.toLowerCase().indexOf(t.queryLower)===-1)return;let{snippet:l,matches:c}=j8(e,t.queryLower);t.results.push({deepKey:o,label:r.join(" \u203A "),snippet:l,matches:c,fieldType:n,richTextBlock:i?.block,richTextInline:i?.inline})}function j8(t,e){let n=t.toLowerCase(),o=e.length,r=n.indexOf(e);if(r===-1)return{snippet:t,matches:[]};let i=Math.max(0,r-kM),s=Math.min(t.length,r+o+kM),a=i>0?"\u2026":"",l=s<t.length?"\u2026":"",c=t.slice(i,s),d=`${a}${c}${l}`,u=[],p=c.toLowerCase(),f=0;for(;f<p.length;){let h=p.indexOf(e,f);if(h===-1)break;u.push({start:h+a.length,end:h+a.length+o}),f=h+o}return{snippet:d,matches:u}}zs();ke();var PM=Ot({blocks:new Map});function FM(t){return g(PM.Provider,{value:{blocks:t.blocks,onEditBlock:t.onEditBlock},children:t.children})}function BM(){return It(PM)}zs();ke();var $M=Ot({components:new Map});function zM(t){return g($M.Provider,{value:{components:t.components,onEditComponent:t.onEditComponent},children:t.children})}function HM(){return It($M)}zs();ke();var KM=Ot({});function UM(t){let e=J(()=>({historyState:cI()}),[]);return g(KM.Provider,{value:e,children:t.children})}function jM(){return It(KM)}zs();ke();var Ff={paragraph:"Normal",h1:"Heading 1",h2:"Heading 2",h3:"Heading 3",h4:"Heading 4",h5:"Heading 5",h6:"Heading 6",bullet:"Bulleted List",number:"Numbered List",quote:"Quote"},V8={blockType:"paragraph",canRedo:!1,canUndo:!1,codeLanguage:"",elementFormat:"left",isBold:!1,isCode:!1,isHighlight:!1,isImageCaption:!1,isItalic:!1,isLink:!1,isRTL:!1,isStrikethrough:!1,isSubscript:!1,isSuperscript:!1,isUnderline:!1,isLowercase:!1,isUppercase:!1,isCapitalize:!1,rootType:"root"},VM=Ot(void 0);function WM(t){let[e,n]=R(V8),o=we((i,s)=>{n(a=>({...a,[i]:s}))},[]),r=J(()=>({toolbarState:e,updateToolbarState:o}),[e,o]);return g(VM.Provider,{value:r,children:t.children})}function Bf(){let t=It(VM);if(t===void 0)throw new Error("useToolbar must be used within a ToolbarProvider");return t}var GM={autocomplete:"LexicalTheme__autocomplete",blockCursor:"LexicalTheme__blockCursor",characterLimit:"LexicalTheme__characterLimit",code:"LexicalTheme__code",codeHighlight:{atrule:"LexicalTheme__tokenAttr",attr:"LexicalTheme__tokenAttr",boolean:"LexicalTheme__tokenProperty",builtin:"LexicalTheme__tokenSelector",cdata:"LexicalTheme__tokenComment",char:"LexicalTheme__tokenSelector",class:"LexicalTheme__tokenFunction","class-name":"LexicalTheme__tokenFunction",comment:"LexicalTheme__tokenComment",constant:"LexicalTheme__tokenProperty",deleted:"LexicalTheme__tokenProperty",doctype:"LexicalTheme__tokenComment",entity:"LexicalTheme__tokenOperator",function:"LexicalTheme__tokenFunction",important:"LexicalTheme__tokenVariable",inserted:"LexicalTheme__tokenSelector",keyword:"LexicalTheme__tokenAttr",namespace:"LexicalTheme__tokenVariable",number:"LexicalTheme__tokenProperty",operator:"LexicalTheme__tokenOperator",prolog:"LexicalTheme__tokenComment",property:"LexicalTheme__tokenProperty",punctuation:"LexicalTheme__tokenPunctuation",regex:"LexicalTheme__tokenVariable",selector:"LexicalTheme__tokenSelector",string:"LexicalTheme__tokenSelector",symbol:"LexicalTheme__tokenProperty",tag:"LexicalTheme__tokenProperty",url:"LexicalTheme__tokenOperator",variable:"LexicalTheme__tokenVariable"},embedBlock:{base:"LexicalTheme__embedBlock",focus:"LexicalTheme__embedBlockFocus"},hashtag:"LexicalTheme__hashtag",heading:{h1:"LexicalTheme__h1",h2:"LexicalTheme__h2",h3:"LexicalTheme__h3",h4:"LexicalTheme__h4",h5:"LexicalTheme__h5",h6:"LexicalTheme__h6"},hr:"LexicalTheme__hr",hrSelected:"LexicalTheme__hrSelected",htmlCode:"LexicalTheme__htmlCode",image:"LexicalTheme__image",indent:"LexicalTheme__indent",layoutContainer:"LexicalTheme__layoutContainer",layoutItem:"LexicalTheme__layoutItem",link:"LexicalTheme__link",list:{checklist:"LexicalTheme__checklist",listitem:"LexicalTheme__listItem",listitemChecked:"LexicalTheme__listItemChecked",listitemUnchecked:"LexicalTheme__listItemUnchecked",nested:{listitem:"LexicalTheme__nestedListItem"},ol:"LexicalTheme__ol",olDepth:["LexicalTheme__ol1","LexicalTheme__ol2","LexicalTheme__ol3","LexicalTheme__ol4","LexicalTheme__ol5"],ul:"LexicalTheme__ul"},ltr:"LexicalTheme__ltr",mark:"LexicalTheme__mark",markOverlap:"LexicalTheme__markOverlap",paragraph:"LexicalTheme__paragraph",quote:"LexicalTheme__quote",rtl:"LexicalTheme__rtl",specialText:"LexicalTheme__specialText",tab:"LexicalTheme__tabNode",table:"LexicalTheme__table",tableAddColumns:"LexicalTheme__tableAddColumns",tableAddRows:"LexicalTheme__tableAddRows",tableCell:"LexicalTheme__tableCell",tableCellActionButton:"LexicalTheme__tableCellActionButton",tableCellActionButtonContainer:"LexicalTheme__tableCellActionButtonContainer",tableCellEditing:"LexicalTheme__tableCellEditing",tableCellHeader:"LexicalTheme__tableCellHeader",tableCellPrimarySelected:"LexicalTheme__tableCellPrimarySelected",tableCellResizer:"LexicalTheme__tableCellResizer",tableCellSelected:"LexicalTheme__tableCellSelected",tableCellSortedIndicator:"LexicalTheme__tableCellSortedIndicator",tableResizeRuler:"LexicalTheme__tableResizeRuler",tableSelected:"LexicalTheme__tableSelected",tableSelection:"LexicalTheme__tableSelection",text:{bold:"LexicalTheme__textBold",capitalize:"LexicalTheme__textCapitalize",code:"LexicalTheme__textCode",highlight:"LexicalTheme__textHighlight",italic:"LexicalTheme__textItalic",lowercase:"LexicalTheme__textLowercase",strikethrough:"LexicalTheme__textStrikethrough",subscript:"LexicalTheme__textSubscript",superscript:"LexicalTheme__textSuperscript",underline:"LexicalTheme__textUnderline",underlineStrikethrough:"LexicalTheme__textUnderlineStrikethrough",uppercase:"LexicalTheme__textUppercase"}};ke();var ul=class extends Zs{constructor(n,o="block"){super();this.listeners=new Map;this.docId="custom-block";this.collectionId="custom-block";this.slug="custom-block";this.data={[o]:Ze(n)}}getValue(n){return Po(this.data,n)}async updateKey(n,o){YM(this.data,n,o),this.notify(n)}async updateKeys(n){for(let[o,r]of Object.entries(n))YM(this.data,o,r),this.notify(o)}async removeKey(n){W8(this.data,n),this.notify(n)}subscribe(n,o){return this.listeners.has(n)||this.listeners.set(n,new Set),this.listeners.get(n).add(o),o(this.getValue(n)),()=>{this.listeners.get(n)?.delete(o)}}subscribeSubtree(n,o){return this.subscribe(n,o)}getDataSnapshot(){return Ze(this.data)}getData(){return this.getDataSnapshot()}notify(n){this.dispatch("VALUE_CHANGE",n,this.getValue(n));for(let o of G8(n)){let r=this.listeners.get(o);if(!r)continue;let i=this.getValue(o);r.forEach(s=>s(i))}}};function YM(t,e,n){let o=e.split("."),r=t;for(let i=0;i<o.length-1;i++){let s=o[i];(typeof r[s]!="object"||r[s]===null||Array.isArray(r[s]))&&(r[s]={}),r=r[s]}r[o.at(-1)]=n}function W8(t,e){let n=e.split("."),o=t;for(let r=0;r<n.length-1;r++)if(o=o?.[n[r]],typeof o!="object"||o===null)return;o&&delete o[n.at(-1)]}function G8(t){let e=t.split("."),n=[];for(let o=e.length;o>0;o--)n.push(e.slice(0,o).join("."));return n}function qM(t){let e=J(()=>new ul(t.initialValue||{}),[t.schema,t.initialValue]),n=J(()=>({loading:!1,controller:e}),[e]),o=J(()=>({type:"object",id:"block",label:t.schema.label||t.schema.name,variant:"inline",fields:t.schema.fields}),[t.schema]),r=()=>{let s=e.getValue("block")||{},a=Ze(s);t.schema.name==="image"&&a?.file?.src&&(a.file.url=Y8(a.file.src)),t.onSubmit(a)},i=at();return g(ld,{...i,opened:t.opened,onClose:t.onClose,title:t.schema.label||t.schema.name,size:"lg",zIndex:190,children:g(qr,{spacing:"md",children:[t.schema.fields.length>0?g($d,{value:n,children:g(Ne.ObjectField,{field:o,deepKey:"block"})}):g(sr,{size:"sm",color:"dimmed",children:"This block does not define any editable fields."}),g(ar,{position:"right",spacing:"sm",children:[g(ee,{variant:"default",size:"xs",onClick:t.onClose,children:"Cancel"}),g(ee,{size:"xs",onClick:r,children:t.mode==="edit"?"Save block":"Insert block"})]})]})})}function Y8(t){return q8(t)?`${t}=s0-e365`:t}function q8(t){return t.startsWith("https://lh3.googleusercontent.com/")}var fv={};Re(fv,{$isDecoratorBlockNode:()=>J8,DecoratorBlockNode:()=>$f});var $f=class extends Wa{constructor(e,n){super(n),this.__format=e||""}exportJSON(){return{...super.exportJSON(),format:this.__format||""}}updateFromJSON(e){return super.updateFromJSON(e).setFormat(e.format||"")}canIndent(){return!1}createDOM(){return document.createElement("div")}updateDOM(){return!1}setFormat(e){let n=this.getWritable();return n.__format=e,n}isInline(){return!1}};function J8(t){return t instanceof $f}var JM=fv,XM=JM.$isDecoratorBlockNode,ZM=JM.DecoratorBlockNode;ke();function X8(t){let{nodeKey:e}=t,[n]=be(),[o,r,i]=_f(e),{blocks:s,onEditBlock:a}=BM(),l=s.get(t.blockName),c=l?.label||l?.name||t.blockName,d=J(()=>{if(l)return Zw(l,t.data)},[l,t.data]),u=J(()=>{if(l)return Qw(l,t.data)},[l,t.data]);return P(()=>Be(n.registerCommand(Xo,p=>{let f=p.target;return!f||!f.closest(`[data-node-key="${e}"]`)?!1:(p.preventDefault(),p.stopPropagation(),o?r(!1):(i(),r(!0)),!0)},Ae)),[n,o,e,i,r]),g("div",{className:Se("LexicalEditor__customBlock",o&&"LexicalEditor__customBlock--selected"),"data-node-key":e,children:[g("div",{className:"LexicalEditor__customBlock__header",children:[g("div",{className:"LexicalEditor__customBlock__header__title",children:c}),l&&a&&g("div",{className:"LexicalEditor__customBlock__actions",children:g(ee,{size:"xs",variant:"default",compact:!0,onClick:()=>a(t.blockName,{mode:"edit",nodeKey:t.nodeKey,initialValue:t.data}),children:"Edit block"})})]}),u&&uE(u)&&g("div",{className:"LexicalEditor__customBlock__previewImage",children:[g("img",{src:u,alt:""}),t.data.loading&&g("div",{className:"LexicalEditor__customBlock__previewImage__loading",children:g(Qt,{variant:"oval",color:"gray"})})]}),d&&g("div",{className:Se("LexicalEditor__customBlock__preview",l?.name==="html"&&"LexicalEditor__customBlock__preview--html"),children:d})]})}var pl=class t extends ZM{static getType(){return"block-component"}static clone(e){return new t(e.__blockName,e.__blockData,e.__key)}static importJSON(e){let{blockName:n,data:o}=e;return new t(n,o)}exportJSON(){return{...super.exportJSON(),type:"block-component",blockName:this.__blockName,data:Ze(this.__blockData),version:1}}constructor(e,n,o){super("",o),this.__blockName=e,this.__blockData=n?Ze(n):{}}createDOM(){let e=document.createElement("div");return e.className="LexicalEditor__customBlockWrapper",e}updateDOM(){return!1}decorate(){return g(X8,{blockName:this.__blockName,data:this.__blockData,nodeKey:this.__key})}getBlockName(){return this.__blockName}getBlockData(){return this.__blockData}setBlockData(e){let n=this.getWritable();n.__blockData=Ze(e)}};function Is(t,e){return new pl(t,e)}function Hr(t){return t instanceof pl}ke();function QM(t){let[e,n]=R(t.componentId);P(()=>{n(t.componentId)},[t.componentId]);let o=J(()=>new ul(t.initialValue||{},"component"),[t.schema,t.initialValue]),r=J(()=>({loading:!1,controller:o}),[o]),i=J(()=>({type:"object",id:"component",label:t.schema.label||t.schema.name,variant:"inline",fields:t.schema.fields}),[t.schema]),s=()=>{let l=o.getValue("component")||{},c=Ze(l);t.onSubmit({componentId:e.trim(),data:c})},a=at();return g(ld,{...a,opened:t.opened,onClose:t.onClose,title:t.schema.label||t.schema.name,size:"lg",zIndex:190,children:g(qr,{spacing:"md",children:[g(lr,{label:"Component ID",value:e,onChange:l=>n(l.currentTarget.value),placeholder:"component-id",required:!0}),t.schema.fields.length>0?g($d,{value:r,children:g(Ne.ObjectField,{field:i,deepKey:"component"})}):g(sr,{size:"sm",color:"dimmed",children:"This component does not define any editable fields."}),g(ar,{position:"right",spacing:"sm",children:[g(ee,{variant:"default",size:"xs",onClick:t.onClose,children:"Cancel"}),g(ee,{size:"xs",onClick:s,disabled:!e.trim(),children:t.mode==="edit"?"Save component":"Insert component"})]})]})})}Hs();function Z8(t){let{componentName:e,componentId:n,nodeKey:o}=t,{components:r,onEditComponent:i}=HM(),s=r.get(e),a=s?.label||s?.name||e,l=we(c=>{c.preventDefault(),c.stopPropagation(),i&&i(e,{componentId:n,initialValue:t.data,mode:"edit",nodeKey:o})},[e,n,o,i,t.data]);return g("span",{className:"LexicalEditor__inlineComponent","data-node-key":o,contentEditable:!1,children:g("button",{type:"button",className:Se("LexicalEditor__inlineComponent__button",!i&&"LexicalEditor__inlineComponent__button--disabled"),onClick:i?l:void 0,title:a?`${a} (${n})`:n,contentEditable:!1,children:[g("span",{className:"LexicalEditor__inlineComponent__label",children:a}),g("span",{className:"LexicalEditor__inlineComponent__id",children:n})]})})}var fl=class t extends Wa{static getType(){return"inline-component"}static clone(e){return new t(e.__componentName,e.__componentId,e.__componentData,e.__key)}static importJSON(e){let{componentName:n,componentId:o,data:r}=e;return new t(n,o,r)}exportJSON(){return{...super.exportJSON(),type:"inline-component",componentName:this.__componentName,componentId:this.__componentId,data:Ze(this.__componentData),version:1}}constructor(e,n,o,r){super(r),this.__componentName=e,this.__componentId=n,this.__componentData=o?Ze(o):{}}createDOM(){let e=document.createElement("span");return e.className="LexicalEditor__inlineComponentWrapper",e.contentEditable="false",e}updateDOM(){return!1}isInline(){return!0}isIsolated(){return!0}decorate(){return g(Z8,{componentName:this.__componentName,componentId:this.__componentId,data:this.__componentData,nodeKey:this.__key})}getComponentName(){return this.__componentName}setComponentName(e){let n=this.getWritable();n.__componentName=e}getComponentId(){return this.__componentId}setComponentId(e){let n=this.getWritable();n.__componentId=e}getComponentData(){return this.__componentData}setComponentData(e){let n=this.getWritable();n.__componentData=Ze(e)}};function zf(t,e,n){return new fl(t,e,n)}function hl(t){return t instanceof fl}var Mi=class t extends Ft{static getType(){return"special-character"}static clone(e){return new t(e.__text,e.__key)}static importJSON(e){return hv(e.text)}constructor(e,n){super(e,n)}exportJSON(){return{...super.exportJSON(),type:"special-character"}}createDOM(e){let n=super.createDOM(e);return Ve(n,"SpecialCharacterNode"),n}updateDOM(e,n,o){let r=super.updateDOM(e,n,o);return Ve(n,"SpecialCharacterNode"),r}isTextEntity(){return!0}canInsertTextAfter(){return!1}};function hv(t){return new Mi(t)}function eA(t){return t instanceof Mi}Hs();ke();function Kr(t){let e=t.anchor,n=t.focus,o=t.anchor.getNode(),r=t.focus.getNode();return o===r?o:t.isBackward()?zy(n)?o:r:zy(e)?o:r}function tA(t,e){let n=t.getRangeAt(0),o;if(t.anchorNode===e){let r=e;for(;r.firstElementChild!==null;)r=r.firstElementChild;o=r.getBoundingClientRect()}else o=n.getBoundingClientRect();return o}var Q8=10,eV=5;function tV(t){let{editor:e,isLink:n,setIsLink:o,anchorElem:r,isLinkEditMode:i,setIsLinkEditMode:s,onDismiss:a}=t,l=Y(null),c=Y(null),[d,u]=R(""),[p,f]=R(""),[h,m]=R(null),[_,b]=R(null),[y,x]=R(null),v=Y(""),E=we(()=>{let S=$();if(F(S)){let I=Kr(S),L=le(I,Je),K="",W=null;L?(K=L.getURL(),W=L.getTarget()||null):Je(I)&&(K=I.getURL(),W=I.getTarget()||null),u(K),m(W);let q=c.current===document.activeElement,B=K!==v.current;(!q||B)&&(f(Ur(K)),b(W)),v.current=K}else if(ct(S)){let I=S.getNodes();if(I.length>0){let L=I[0],K=L.getParent(),W="",q=null;Je(K)?(W=K.getURL(),q=K.getTarget()||null):Je(L)&&(W=L.getURL(),q=L.getTarget()||null),u(W),m(q);let B=c.current===document.activeElement,se=W!==v.current;(!B||se)&&(f(Ur(W)),b(q)),v.current=W}}let N=l.current,D=Jn(e._window),O=document.activeElement;if(N===null)return;let M=e.getRootElement();if(S!==null&&M!==null&&e.isEditable()){let I;if(ct(S)){let L=S.getNodes();if(L.length>0){let K=e.getElementByKey(L[0].getKey());K&&(I=K.getBoundingClientRect())}}else D!==null&&M.contains(D.anchorNode)&&(I=D.focusNode?.parentElement?.getBoundingClientRect());I&&(I.y+=40,nA(I,N,r)),x(S)}else(!O||O.className!=="link-input")&&(M!==null&&nA(null,N,r),x(null),s(!1),u(""),v.current="");return!0},[r,e,s,i,d]);P(()=>{let S=r.parentElement,N=()=>{e.getEditorState().read(()=>{E()})};return window.addEventListener("resize",N),S&&S.addEventListener("scroll",N),()=>{window.removeEventListener("resize",N),S&&S.removeEventListener("scroll",N)}},[r.parentElement,e,E]),P(()=>Be(e.registerUpdateListener(({editorState:S})=>{S.read(()=>{E()})}),e.registerCommand(cn,()=>(E(),!0),Ae),e.registerCommand(Ci,()=>n?(o(!1),a?.(),!0):!1,xi)),[e,E,o,n]),P(()=>{e.getEditorState().read(()=>{E()})},[e,E]),P(()=>{n&&e.getEditorState().read(()=>{E()})},[n,e,E]),P(()=>{i&&c.current&&c.current.focus()},[i,n]),P(()=>{if(!n)return;let S=()=>{o(!1),s(!1),a?.()},N=O=>{let M=O.target;M&&(l.current&&l.current.contains(M)||r.contains(M)||r.parentElement&&r.parentElement.contains(M)||S())},D=O=>{O.key==="Escape"&&l.current&&l.current.contains(document.activeElement)&&(O.preventDefault(),S())};return window.addEventListener("mousedown",N),window.addEventListener("keydown",D),()=>{window.removeEventListener("mousedown",N),window.removeEventListener("keydown",D)}},[n,r,o,s]);let C=S=>{S.key==="Enter"?(S.preventDefault(),k()):S.key==="Escape"&&(S.preventDefault(),o(!1),s(!1),a?.())},k=S=>{if(S&&S.preventDefault(),y!==null){if(d!==null){let N=_==="_blank"?"_blank":null;e.update(()=>{let D=$();if(F(D)){let O=Kr(D),M=le(O,Je);M?(M.setURL(Ur(p)),M.setTarget(N)):Je(O)?(O.setURL(Ur(p)),O.setTarget(N)):e.dispatchCommand(Bn,{url:Ur(p),target:N})}else if(ct(D)){let O=D.getNodes();if(O.length>0){let M=O[0],I=M.getParent();Je(I)?(I.setURL(Ur(p)),I.setTarget(N)):Je(M)&&(M.setURL(Ur(p)),M.setTarget(N))}}})}s(!1)}},T=Ur(p)!==Ur(d)||_!==h,w=()=>{f(d),b(h)};return g("div",{ref:l,className:Se("LexicalEditor__linkEditor",!n&&"LexicalEditor__linkEditor--hidden"),children:!n||!y?null:g("div",{className:"LexicalEditor__link__editForm",children:[g(Lo,{ref:c,className:"LexicalEditor__link__input",value:p,onChange:S=>{let N=S.target;f(N.value)},onKeyDown:S=>{C(S)},autosize:!0,minRows:1,radius:"xs",placeholder:"https://"}),g("div",{className:"LexicalEditor__link__row",children:[g(Ao,{className:"LexicalEditor__link__target",label:"Open in new tab",checked:_==="_blank",onChange:S=>b(S.currentTarget.checked?"_blank":null),size:"xs"}),g("div",{className:"LexicalEditor__link__controls",children:[g(gv,{tooltip:"Remove",onClick:()=>{e.dispatchCommand(Bn,null)},children:g(ho,{size:12})}),g(gv,{tooltip:"Undo",onClick:w,disabled:!T,children:g(Jr,{size:12})}),g(gv,{tooltip:"Save",onClick:()=>k(),disabled:!T,color:"green",children:g(zi,{size:12})})]})]})]})})}function gv(t){return g(De,{label:t.tooltip,position:"top",withArrow:!0,children:g(Pe,{radius:"xl",variant:t.color?"filled":"default",color:t.color||"dark",size:"sm",title:t.tooltip,onClick:t.onClick,disabled:t.disabled,children:t.children})})}function nV(t,e,n,o){let[r,i]=R(t),[s,a]=R(!1),l=Y(0),c=300,d=we(()=>{l.current=Date.now()},[]);return P(()=>{function u(){if(Date.now()-l.current<c)return;let p=$();if(F(p)){let f=Kr(p),h=le(f,Je),m=le(f,Uc);if(!(h||m)){a(!1);return}let _=p.getNodes().filter(b=>!qe(b)).find(b=>{let y=le(b,Je),x=le(b,Uc);return h&&!h.is(y)||y&&!y.is(h)||m&&!m.is(x)||x&&(!x.is(m)||x.getIsUnlinked())});a(!_)}else if(ct(p)){let f=p.getNodes();if(f.length===0){a(!1);return}let h=f[0],m=h.getParent();Je(m)||Je(h)?a(!0):a(!1)}}return Be(t.registerUpdateListener(({editorState:p})=>{p.read(()=>{u()})}),t.registerCommand(cn,(p,f)=>(u(),i(f),!1),Ct),t.registerCommand(Xo,p=>{let f=$();if(F(f)){let h=Kr(f),m=le(h,Je);if(m)return p.metaKey||p.ctrlKey?(window.open(m.getURL(),"_blank"),!0):(p.preventDefault(),p.stopPropagation(),!0)}return!1},Ae))},[t]),Yr(g(tV,{editor:r,isLink:s,anchorElem:e,setIsLink:a,isLinkEditMode:n,setIsLinkEditMode:o,onDismiss:d}),e)}function oA(t){let{anchorElem:e=document.body,isLinkEditMode:n,setIsLinkEditMode:o}=t,[r]=be();return nV(r,e,n,o)}function nA(t,e,n,o=Q8,r=eV){let i=n.parentElement;if(t===null||!i){e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)";return}let s=e.getBoundingClientRect(),a=n.getBoundingClientRect(),l=i.getBoundingClientRect(),c=t.top-o,d=t.left-r;c<l.top&&(c+=s.height+t.height+o*2),d+s.width>l.right&&(d=l.right-s.width-r),c-=a.top,d-=a.left,e.style.opacity="1",e.style.transform=`translate(${d}px, ${c}px)`}function Ur(t){return t&&t.trim()}var hse=eh(mv(),1);Prism.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/};Prism.languages.javascript=Prism.languages.extend("clike",{"class-name":[Prism.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/});Prism.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/;Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:Prism.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:Prism.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/});Prism.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}});Prism.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}});Prism.languages.markup&&(Prism.languages.markup.tag.addInlined("script","javascript"),Prism.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript"));Prism.languages.js=Prism.languages.javascript;Prism.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]};Prism.languages.markup.tag.inside["attr-value"].inside.entity=Prism.languages.markup.entity;Prism.languages.markup.doctype.inside["internal-subset"].inside=Prism.languages.markup;Prism.hooks.add("wrap",function(t){t.type==="entity"&&(t.attributes.title=t.content.replace(/&/,"&"))});Object.defineProperty(Prism.languages.markup.tag,"addInlined",{value:function(e,n){var o={};o["language-"+n]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:Prism.languages[n]},o.cdata=/^<!\[CDATA\[|\]\]>$/i;var r={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:o}};r["language-"+n]={pattern:/[\s\S]+/,inside:Prism.languages[n]};var i={};i[e]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return e}),"i"),lookbehind:!0,greedy:!0,inside:r},Prism.languages.insertBefore("markup","cdata",i)}});Object.defineProperty(Prism.languages.markup.tag,"addAttribute",{value:function(t,e){Prism.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+t+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[e,"language-"+e],inside:Prism.languages[e]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}});Prism.languages.html=Prism.languages.markup;Prism.languages.mathml=Prism.languages.markup;Prism.languages.svg=Prism.languages.markup;Prism.languages.xml=Prism.languages.extend("markup",{});Prism.languages.ssml=Prism.languages.xml;Prism.languages.atom=Prism.languages.xml;Prism.languages.rss=Prism.languages.xml;(function(t){var e=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function n(d){return d=d.replace(/<inner>/g,function(){return e}),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+d+")")}var o=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,r=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,function(){return o}),i=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;t.languages.markdown=t.languages.extend("markup",{}),t.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:t.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+r+i+"(?:"+r+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+r+i+")(?:"+r+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(o),inside:t.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+r+")"+i+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+r+"$"),inside:{"table-header":{pattern:RegExp(o),alias:"important",inside:t.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:n(/\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:n(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:n(/(~~?)(?:(?!~)<inner>)+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:n(/!?\[(?:(?!\])<inner>)+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\])<inner>)+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach(function(d){["url","bold","italic","strike","code-snippet"].forEach(function(u){d!==u&&(t.languages.markdown[d].inside.content.inside[u]=t.languages.markdown[u])})}),t.hooks.add("after-tokenize",function(d){if(d.language!=="markdown"&&d.language!=="md")return;function u(p){if(!(!p||typeof p=="string"))for(var f=0,h=p.length;f<h;f++){var m=p[f];if(m.type!=="code"){u(m.content);continue}var _=m.content[1],b=m.content[3];if(_&&b&&_.type==="code-language"&&b.type==="code-block"&&typeof _.content=="string"){var y=_.content.replace(/\b#/g,"sharp").replace(/\b\+\+/g,"pp");y=(/[a-z][\w-]*/i.exec(y)||[""])[0].toLowerCase();var x="language-"+y;b.alias?typeof b.alias=="string"?b.alias=[b.alias,x]:b.alias.push(x):b.alias=[x]}}}u(d.tokens)}),t.hooks.add("wrap",function(d){if(d.type==="code-block"){for(var u="",p=0,f=d.classes.length;p<f;p++){var h=d.classes[p],m=/language-(.+)/.exec(h);if(m){u=m[1];break}}var _=t.languages[u];if(_)d.content=t.highlight(c(d.content),_,u);else if(u&&u!=="none"&&t.plugins.autoloader){var b="md-"+new Date().valueOf()+"-"+Math.floor(Math.random()*1e16);d.attributes.id=b,t.plugins.autoloader.loadLanguages(u,function(){var y=document.getElementById(b);y&&(y.innerHTML=t.highlight(y.textContent,t.languages[u],u))})}}});var s=RegExp(t.languages.markup.tag.pattern.source,"gi"),a={amp:"&",lt:"<",gt:">",quot:'"'},l=String.fromCodePoint||String.fromCharCode;function c(d){var u=d.replace(s,"");return u=u.replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi,function(p,f){if(f=f.toLowerCase(),f[0]==="#"){var h;return f[1]==="x"?h=parseInt(f.slice(2),16):h=Number(f.slice(1)),l(h)}else{var m=a[f];return m||p}}),u}t.languages.md=t.languages.markdown})(Prism);Prism.languages.c=Prism.languages.extend("clike",{comment:{pattern:/\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},"class-name":{pattern:/(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,lookbehind:!0},keyword:/\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|__attribute__|asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|inline|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|typeof|union|unsigned|void|volatile|while)\b/,function:/\b[a-z_]\w*(?=\s*\()/i,number:/(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,operator:/>>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/});Prism.languages.insertBefore("c","string",{char:{pattern:/'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,greedy:!0}});Prism.languages.insertBefore("c","string",{macro:{pattern:/(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,lookbehind:!0,greedy:!0,alias:"property",inside:{string:[{pattern:/^(#\s*include\s*)<[^>]+>/,lookbehind:!0},Prism.languages.c.string],char:Prism.languages.c.char,comment:Prism.languages.c.comment,"macro-name":[{pattern:/(^#\s*define\s+)\w+\b(?!\()/i,lookbehind:!0},{pattern:/(^#\s*define\s+)\w+\b(?=\()/i,lookbehind:!0,alias:"function"}],directive:{pattern:/^(#\s*)[a-z]+/,lookbehind:!0,alias:"keyword"},"directive-hash":/^#/,punctuation:/##|\\(?=[\r\n])/,expression:{pattern:/\S[\s\S]*/,inside:Prism.languages.c}}}});Prism.languages.insertBefore("c","function",{constant:/\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/});delete Prism.languages.c.boolean;(function(t){var e=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;t.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+e.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+e.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+e.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+e.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:e,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},t.languages.css.atrule.inside.rest=t.languages.css;var n=t.languages.markup;n&&(n.tag.addInlined("style","css"),n.tag.addAttribute("style","css"))})(Prism);Prism.languages.objectivec=Prism.languages.extend("c",{string:{pattern:/@?"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},keyword:/\b(?:asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|in|inline|int|long|register|return|self|short|signed|sizeof|static|struct|super|switch|typedef|typeof|union|unsigned|void|volatile|while)\b|(?:@interface|@end|@implementation|@protocol|@class|@public|@protected|@private|@property|@try|@catch|@finally|@throw|@synthesize|@dynamic|@selector)\b/,operator:/-[->]?|\+\+?|!=?|<<?=?|>>?=?|==?|&&?|\|\|?|[~^%?*\/@]/});delete Prism.languages.objectivec["class-name"];Prism.languages.objc=Prism.languages.objectivec;Prism.languages.sql={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},variable:[{pattern:/@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,greedy:!0},/@[\w.$]+/],string:{pattern:/(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,greedy:!0,lookbehind:!0},identifier:{pattern:/(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,greedy:!0,lookbehind:!0,inside:{punctuation:/^`|`$/}},function:/\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,keyword:/\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,boolean:/\b(?:FALSE|NULL|TRUE)\b/i,number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,operator:/[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/};(function(t){var e=t.languages.powershell={comment:[{pattern:/(^|[^`])<#[\s\S]*?#>/,lookbehind:!0},{pattern:/(^|[^`])#.*/,lookbehind:!0}],string:[{pattern:/"(?:`[\s\S]|[^`"])*"/,greedy:!0,inside:null},{pattern:/'(?:[^']|'')*'/,greedy:!0}],namespace:/\[[a-z](?:\[(?:\[[^\]]*\]|[^\[\]])*\]|[^\[\]])*\]/i,boolean:/\$(?:false|true)\b/i,variable:/\$\w+\b/,function:[/\b(?:Add|Approve|Assert|Backup|Block|Checkpoint|Clear|Close|Compare|Complete|Compress|Confirm|Connect|Convert|ConvertFrom|ConvertTo|Copy|Debug|Deny|Disable|Disconnect|Dismount|Edit|Enable|Enter|Exit|Expand|Export|Find|ForEach|Format|Get|Grant|Group|Hide|Import|Initialize|Install|Invoke|Join|Limit|Lock|Measure|Merge|Move|New|Open|Optimize|Out|Ping|Pop|Protect|Publish|Push|Read|Receive|Redo|Register|Remove|Rename|Repair|Request|Reset|Resize|Resolve|Restart|Restore|Resume|Revoke|Save|Search|Select|Send|Set|Show|Skip|Sort|Split|Start|Step|Stop|Submit|Suspend|Switch|Sync|Tee|Test|Trace|Unblock|Undo|Uninstall|Unlock|Unprotect|Unpublish|Unregister|Update|Use|Wait|Watch|Where|Write)-[a-z]+\b/i,/\b(?:ac|cat|chdir|clc|cli|clp|clv|compare|copy|cp|cpi|cpp|cvpa|dbp|del|diff|dir|ebp|echo|epal|epcsv|epsn|erase|fc|fl|ft|fw|gal|gbp|gc|gci|gcs|gdr|gi|gl|gm|gp|gps|group|gsv|gu|gv|gwmi|iex|ii|ipal|ipcsv|ipsn|irm|iwmi|iwr|kill|lp|ls|measure|mi|mount|move|mp|mv|nal|ndr|ni|nv|ogv|popd|ps|pushd|pwd|rbp|rd|rdr|ren|ri|rm|rmdir|rni|rnp|rp|rv|rvpa|rwmi|sal|saps|sasv|sbp|sc|select|set|shcm|si|sl|sleep|sls|sort|sp|spps|spsv|start|sv|swmi|tee|trcm|type|write)\b/i],keyword:/\b(?:Begin|Break|Catch|Class|Continue|Data|Define|Do|DynamicParam|Else|ElseIf|End|Exit|Filter|Finally|For|ForEach|From|Function|If|InlineScript|Parallel|Param|Process|Return|Sequence|Switch|Throw|Trap|Try|Until|Using|Var|While|Workflow)\b/i,operator:{pattern:/(^|\W)(?:!|-(?:b?(?:and|x?or)|as|(?:Not)?(?:Contains|In|Like|Match)|eq|ge|gt|is(?:Not)?|Join|le|lt|ne|not|Replace|sh[lr])\b|-[-=]?|\+[+=]?|[*\/%]=?)/i,lookbehind:!0},punctuation:/[|{}[\];(),.]/};e.string[0].inside={function:{pattern:/(^|[^`])\$\((?:\$\([^\r\n()]*\)|(?!\$\()[^\r\n)])*\)/,lookbehind:!0,inside:e},boolean:e.boolean,variable:e.variable}})(Prism);Prism.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern://,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/};Prism.languages.python["string-interpolation"].inside.interpolation.inside.rest=Prism.languages.python;Prism.languages.py=Prism.languages.python;(function(t){for(var e=/\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|<self>)*\*\//.source,n=0;n<2;n++)e=e.replace(/<self>/g,function(){return e});e=e.replace(/<self>/g,function(){return/[^\s\S]/.source}),t.languages.rust={comment:[{pattern:RegExp(/(^|[^\\])/.source+e),lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/b?"(?:\\[\s\S]|[^\\"])*"|b?r(#*)"(?:[^"]|"(?!\1))*"\1/,greedy:!0},char:{pattern:/b?'(?:\\(?:x[0-7][\da-fA-F]|u\{(?:[\da-fA-F]_*){1,6}\}|.)|[^\\\r\n\t'])'/,greedy:!0},attribute:{pattern:/#!?\[(?:[^\[\]"]|"(?:\\[\s\S]|[^\\"])*")*\]/,greedy:!0,alias:"attr-name",inside:{string:null}},"closure-params":{pattern:/([=(,:]\s*|\bmove\s*)\|[^|]*\||\|[^|]*\|(?=\s*(?:\{|->))/,lookbehind:!0,greedy:!0,inside:{"closure-punctuation":{pattern:/^\||\|$/,alias:"punctuation"},rest:null}},"lifetime-annotation":{pattern:/'\w+/,alias:"symbol"},"fragment-specifier":{pattern:/(\$\w+:)[a-z]+/,lookbehind:!0,alias:"punctuation"},variable:/\$\w+/,"function-definition":{pattern:/(\bfn\s+)\w+/,lookbehind:!0,alias:"function"},"type-definition":{pattern:/(\b(?:enum|struct|trait|type|union)\s+)\w+/,lookbehind:!0,alias:"class-name"},"module-declaration":[{pattern:/(\b(?:crate|mod)\s+)[a-z][a-z_\d]*/,lookbehind:!0,alias:"namespace"},{pattern:/(\b(?:crate|self|super)\s*)::\s*[a-z][a-z_\d]*\b(?:\s*::(?:\s*[a-z][a-z_\d]*\s*::)*)?/,lookbehind:!0,alias:"namespace",inside:{punctuation:/::/}}],keyword:[/\b(?:Self|abstract|as|async|await|become|box|break|const|continue|crate|do|dyn|else|enum|extern|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|override|priv|pub|ref|return|self|static|struct|super|trait|try|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\b/,/\b(?:bool|char|f(?:32|64)|[ui](?:8|16|32|64|128|size)|str)\b/],function:/\b[a-z_]\w*(?=\s*(?:::\s*<|\())/,macro:{pattern:/\b\w+!/,alias:"property"},constant:/\b[A-Z_][A-Z_\d]+\b/,"class-name":/\b[A-Z]\w*\b/,namespace:{pattern:/(?:\b[a-z][a-z_\d]*\s*::\s*)*\b[a-z][a-z_\d]*\s*::(?!\s*<)/,inside:{punctuation:/::/}},number:/\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)(?:_?(?:f32|f64|[iu](?:8|16|32|64|size)?))?\b/,boolean:/\b(?:false|true)\b/,punctuation:/->|\.\.=|\.{1,3}|::|[{}[\];(),:]/,operator:/[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<<?=?|>>?=?|[@?]/},t.languages.rust["closure-params"].inside.rest=t.languages.rust,t.languages.rust.attribute.inside.string=t.languages.rust.string})(Prism);Prism.languages.swift={comment:{pattern:/(^|[^\\:])(?:\/\/.*|\/\*(?:[^/*]|\/(?!\*)|\*(?!\/)|\/\*(?:[^*]|\*(?!\/))*\*\/)*\*\/)/,lookbehind:!0,greedy:!0},"string-literal":[{pattern:RegExp(/(^|[^"#])/.source+"(?:"+/"(?:\\(?:\((?:[^()]|\([^()]*\))*\)|\r\n|[^(])|[^\\\r\n"])*"/.source+"|"+/"""(?:\\(?:\((?:[^()]|\([^()]*\))*\)|[^(])|[^\\"]|"(?!""))*"""/.source+")"+/(?!["#])/.source),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\\($/,alias:"punctuation"},punctuation:/\\(?=[\r\n])/,string:/[\s\S]+/}},{pattern:RegExp(/(^|[^"#])(#+)/.source+"(?:"+/"(?:\\(?:#+\((?:[^()]|\([^()]*\))*\)|\r\n|[^#])|[^\\\r\n])*?"/.source+"|"+/"""(?:\\(?:#+\((?:[^()]|\([^()]*\))*\)|[^#])|[^\\])*?"""/.source+")\\2"),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\#+\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\#+\($/,alias:"punctuation"},string:/[\s\S]+/}}],directive:{pattern:RegExp(/#/.source+"(?:"+(/(?:elseif|if)\b/.source+"(?:[ ]*"+/(?:![ \t]*)?(?:\b\w+\b(?:[ \t]*\((?:[^()]|\([^()]*\))*\))?|\((?:[^()]|\([^()]*\))*\))(?:[ \t]*(?:&&|\|\|))?/.source+")+")+"|"+/(?:else|endif)\b/.source+")"),alias:"property",inside:{"directive-name":/^#\w+/,boolean:/\b(?:false|true)\b/,number:/\b\d+(?:\.\d+)*\b/,operator:/!|&&|\|\||[<>]=?/,punctuation:/[(),]/}},literal:{pattern:/#(?:colorLiteral|column|dsohandle|file(?:ID|Literal|Path)?|function|imageLiteral|line)\b/,alias:"constant"},"other-directive":{pattern:/#\w+\b/,alias:"property"},attribute:{pattern:/@\w+/,alias:"atrule"},"function-definition":{pattern:/(\bfunc\s+)\w+/,lookbehind:!0,alias:"function"},label:{pattern:/\b(break|continue)\s+\w+|\b[a-zA-Z_]\w*(?=\s*:\s*(?:for|repeat|while)\b)/,lookbehind:!0,alias:"important"},keyword:/\b(?:Any|Protocol|Self|Type|actor|as|assignment|associatedtype|associativity|async|await|break|case|catch|class|continue|convenience|default|defer|deinit|didSet|do|dynamic|else|enum|extension|fallthrough|fileprivate|final|for|func|get|guard|higherThan|if|import|in|indirect|infix|init|inout|internal|is|isolated|lazy|left|let|lowerThan|mutating|none|nonisolated|nonmutating|open|operator|optional|override|postfix|precedencegroup|prefix|private|protocol|public|repeat|required|rethrows|return|right|safe|self|set|some|static|struct|subscript|super|switch|throw|throws|try|typealias|unowned|unsafe|var|weak|where|while|willSet)\b/,boolean:/\b(?:false|true)\b/,nil:{pattern:/\bnil\b/,alias:"constant"},"short-argument":/\$\d+\b/,omit:{pattern:/\b_\b/,alias:"keyword"},number:/\b(?:[\d_]+(?:\.[\de_]+)?|0x[a-f0-9_]+(?:\.[a-f0-9p_]+)?|0b[01_]+|0o[0-7_]+)\b/i,"class-name":/\b[A-Z](?:[A-Z_\d]*[a-z]\w*)?\b/,function:/\b[a-z_]\w*(?=\s*\()/i,constant:/\b(?:[A-Z_]{2,}|k[A-Z][A-Za-z_]+)\b/,operator:/[-+*/%=!<>&|^~?]+|\.[.\-+*/%=!<>&|^~?]+/,punctuation:/[{}[\]();,.:\\]/};Prism.languages.swift["string-literal"].forEach(function(t){t.inside.interpolation.inside=Prism.languages.swift});(function(t){t.languages.typescript=t.languages.extend("javascript",{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),t.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete t.languages.typescript.parameter,delete t.languages.typescript["literal-property"];var e=t.languages.extend("typescript",{});delete e["class-name"],t.languages.typescript["class-name"].inside=e,t.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:e}}}}),t.languages.ts=t.languages.typescript})(Prism);(function(t){var e=/\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|open|opens|package|permits|private|protected|provides|public|record(?!\s*[(){}[\]<>=%~.:,;?+\-*/&|^])|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throw|throws|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/,n=/(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source,o={pattern:RegExp(/(^|[^\w.])/.source+n+/[A-Z](?:[\d_A-Z]*[a-z]\w*)?\b/.source),lookbehind:!0,inside:{namespace:{pattern:/^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,inside:{punctuation:/\./}},punctuation:/\./}};t.languages.java=t.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"/,lookbehind:!0,greedy:!0},"class-name":[o,{pattern:RegExp(/(^|[^\w.])/.source+n+/[A-Z]\w*(?=\s+\w+\s*[;,=()]|\s*(?:\[[\s,]*\]\s*)?::\s*new\b)/.source),lookbehind:!0,inside:o.inside},{pattern:RegExp(/(\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\s+)/.source+n+/[A-Z]\w*\b/.source),lookbehind:!0,inside:o.inside}],keyword:e,function:[t.languages.clike.function,{pattern:/(::\s*)[a-z_]\w*/,lookbehind:!0}],number:/\b0b[01][01_]*L?\b|\b0x(?:\.[\da-f_p+-]+|[\da-f_]+(?:\.[\da-f_p+-]+)?)\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfl]?/i,operator:{pattern:/(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[-+*/%&|^!=<>]=?)/m,lookbehind:!0},constant:/\b[A-Z][A-Z_\d]+\b/}),t.languages.insertBefore("java","string",{"triple-quoted-string":{pattern:/"""[ \t]*[\r\n](?:(?:"|"")?(?:\\.|[^"\\]))*"""/,greedy:!0,alias:"string"},char:{pattern:/'(?:\\.|[^'\\\r\n]){1,6}'/,greedy:!0}}),t.languages.insertBefore("java","class-name",{annotation:{pattern:/(^|[^.])@\w+(?:\s*\.\s*\w+)*/,lookbehind:!0,alias:"punctuation"},generics:{pattern:/<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&))*>)*>)*>)*>/,inside:{"class-name":o,keyword:e,punctuation:/[<>(),.:]/,operator:/[?&|]/}},import:[{pattern:RegExp(/(\bimport\s+)/.source+n+/(?:[A-Z]\w*|\*)(?=\s*;)/.source),lookbehind:!0,inside:{namespace:o.inside.namespace,punctuation:/\./,operator:/\*/,"class-name":/\w+/}},{pattern:RegExp(/(\bimport\s+static\s+)/.source+n+/(?:\w+|\*)(?=\s*;)/.source),lookbehind:!0,alias:"static",inside:{namespace:o.inside.namespace,static:/\b\w+$/,punctuation:/\./,operator:/\*/,"class-name":/\w+/}}],namespace:{pattern:RegExp(/(\b(?:exports|import(?:\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\s+)(?!<keyword>)[a-z]\w*(?:\.[a-z]\w*)*\.?/.source.replace(/<keyword>/g,function(){return e.source})),lookbehind:!0,inside:{punctuation:/\./}}})})(Prism);(function(t){var e=/\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|char8_t|class|co_await|co_return|co_yield|compl|concept|const|const_cast|consteval|constexpr|constinit|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|final|float|for|friend|goto|if|import|inline|int|int16_t|int32_t|int64_t|int8_t|long|module|mutable|namespace|new|noexcept|nullptr|operator|override|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|uint16_t|uint32_t|uint64_t|uint8_t|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,n=/\b(?!<keyword>)\w+(?:\s*\.\s*\w+)*\b/.source.replace(/<keyword>/g,function(){return e.source});t.languages.cpp=t.languages.extend("c",{"class-name":[{pattern:RegExp(/(\b(?:class|concept|enum|struct|typename)\s+)(?!<keyword>)\w+/.source.replace(/<keyword>/g,function(){return e.source})),lookbehind:!0},/\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,/\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,/\b\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/],keyword:e,number:{pattern:/(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,greedy:!0},operator:/>>=?|<<=?|->|--|\+\+|&&|\|\||[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,boolean:/\b(?:false|true)\b/}),t.languages.insertBefore("cpp","string",{module:{pattern:RegExp(/(\b(?:import|module)\s+)/.source+"(?:"+/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|<[^<>\r\n]*>/.source+"|"+/<mod-name>(?:\s*:\s*<mod-name>)?|:\s*<mod-name>/.source.replace(/<mod-name>/g,function(){return n})+")"),lookbehind:!0,greedy:!0,inside:{string:/^[<"][\s\S]+/,operator:/:/,punctuation:/\./}},"raw-string":{pattern:/R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,alias:"string",greedy:!0}}),t.languages.insertBefore("cpp","keyword",{"generic-function":{pattern:/\b(?!operator\b)[a-z_]\w*\s*<(?:[^<>]|<[^<>]*>)*>(?=\s*\()/i,inside:{function:/^\w+/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:t.languages.cpp}}}}),t.languages.insertBefore("cpp","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}}),t.languages.insertBefore("cpp","class-name",{"base-clause":{pattern:/(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,lookbehind:!0,greedy:!0,inside:t.languages.extend("cpp",{})}}),t.languages.insertBefore("inside","double-colon",{"class-name":/\b[a-z_]\w*\b(?!\s*::)/i},t.languages.cpp["base-clause"])})(Prism);(function(t){t.languages.diff={coord:[/^(?:\*{3}|-{3}|\+{3}).*$/m,/^@@.*@@$/m,/^\d.*$/m]};var e={"deleted-sign":"-","deleted-arrow":"<","inserted-sign":"+","inserted-arrow":">",unchanged:" ",diff:"!"};Object.keys(e).forEach(function(n){var o=e[n],r=[];/^\w+$/.test(n)||r.push(/\w+/.exec(n)[0]),n==="diff"&&r.push("bold"),t.languages.diff[n]={pattern:RegExp("^(?:["+o+`].*(?:\r
|
|
120
|
-
?|
|
|
121
|
-
|(?![\\s\\S])))+`,"m"),alias:r,inside:{line:{pattern:/(.)(?=[\s\S]).*(?:\r\n?|\n)?/,lookbehind:!0},prefix:{pattern:/[\s\S]/,alias:/\w+/.exec(n)[0]}}}}),Object.defineProperty(t.languages.diff,"PREFIXES",{value:e})})(Prism);var Ose=globalThis.Prism||window.Prism;var Tv={};Re(Tv,{$createCodeHighlightNode:()=>jf,$createCodeNode:()=>gl,$getEndOfCodeInLine:()=>wv,$getFirstCodeNodeOfLine:()=>Li,$getLastCodeNodeOfLine:()=>As,$getStartOfCodeInLine:()=>Ev,$isCodeHighlightNode:()=>Nt,$isCodeNode:()=>Oo,CODE_LANGUAGE_FRIENDLY_NAME_MAP:()=>hA,CODE_LANGUAGE_MAP:()=>gA,CodeHighlightNode:()=>Ls,CodeNode:()=>Ai,DEFAULT_CODE_LANGUAGE:()=>Cv,PrismTokenizer:()=>bA,getCodeLanguages:()=>lV,getDefaultCodeLanguage:()=>aV,getEndOfCodeInLine:()=>fV,getFirstCodeNodeOfLine:()=>uV,getLanguageFriendlyName:()=>sV,getLastCodeNodeOfLine:()=>pV,getStartOfCodeInLine:()=>hV,normalizeCodeLang:()=>mA,registerCodeHighlighting:()=>dV});var Lse=eh(mv(),1);function Uf(t,...e){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",t);for(let r of e)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(function(t){t.languages.diff={coord:[/^(?:\*{3}|-{3}|\+{3}).*$/m,/^@@.*@@$/m,/^\d.*$/m]};var e={"deleted-sign":"-","deleted-arrow":"<","inserted-sign":"+","inserted-arrow":">",unchanged:" ",diff:"!"};Object.keys(e).forEach((function(n){var o=e[n],r=[];/^\w+$/.test(n)||r.push(/\w+/.exec(n)[0]),n==="diff"&&r.push("bold"),t.languages.diff[n]={pattern:RegExp("^(?:["+o+`].*(?:\r
|
|
122
|
-
?|
|
|
123
|
-
|(?![\\s\\S])))+`,"m"),alias:r,inside:{line:{pattern:/(.)(?=[\s\S]).*(?:\r\n?|\n)?/,lookbehind:!0},prefix:{pattern:/[\s\S]/,alias:/\w+/.exec(n)[0]}}}})),Object.defineProperty(t.languages.diff,"PREFIXES",{value:e})})(Prism);var fo=globalThis.Prism||window.Prism;function xv(t){return typeof t=="string"?t:Array.isArray(t)?t.map(xv).join(""):xv(t.content)}var rA=t=>{let e=/^diff-([\w-]+)/i;try{if(!t)return!1;let n=e.exec(t);return n?fo.languages.hasOwnProperty("diff")&&fo.languages.hasOwnProperty(n[1]):fo.languages.hasOwnProperty(t)}catch{return!1}};function fA(t,e){for(let n of t.childNodes){if(Jt(n)&&n.tagName===e)return!0;fA(n,e)}return!1}var nd="data-language",Kf="data-highlight-language",Ai=class t extends Pt{static getType(){return"code"}static clone(e){return new t(e.__language,e.__key)}constructor(e,n){super(n),this.__language=e||void 0,this.__isSyntaxHighlightSupported=rA(e)}createDOM(e){let n=document.createElement("code");Ve(n,e.theme.code),n.setAttribute("spellcheck","false");let o=this.getLanguage();return o&&(n.setAttribute(nd,o),this.getIsSyntaxHighlightSupported()&&n.setAttribute(Kf,o)),n}updateDOM(e,n,o){let r=this.__language,i=e.__language;return r?r!==i&&(n.setAttribute(nd,r),this.__isSyntaxHighlightSupported&&n.setAttribute(Kf,r)):i&&(n.removeAttribute(nd),e.__isSyntaxHighlightSupported&&n.removeAttribute(Kf)),!1}exportDOM(e){let n=document.createElement("pre");Ve(n,e._config.theme.code),n.setAttribute("spellcheck","false");let o=this.getLanguage();return o&&(n.setAttribute(nd,o),this.getIsSyntaxHighlightSupported()&&n.setAttribute(Kf,o)),{element:n}}static importDOM(){return{code:e=>e.textContent!=null&&(/\r?\n/.test(e.textContent)||fA(e,"BR"))?{conversion:iA,priority:1}:null,div:()=>({conversion:rV,priority:1}),pre:()=>({conversion:iA,priority:0}),table:e=>_v(e)?{conversion:iV,priority:3}:null,td:e=>{let n=e,o=n.closest("table");return n.classList.contains("js-file-line")||o&&_v(o)?{conversion:sA,priority:3}:null},tr:e=>{let n=e.closest("table");return n&&_v(n)?{conversion:sA,priority:3}:null}}}static importJSON(e){return gl().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setLanguage(e.language)}exportJSON(){return{...super.exportJSON(),language:this.getLanguage()}}insertNewAfter(e,n=!0){let o=this.getChildren(),r=o.length;if(r>=2&&o[r-1].getTextContent()===`
|
|
124
|
-
`&&o[r-2].getTextContent()===`
|
|
125
|
-
`&&e.isCollapsed()&&e.anchor.key===this.__key&&e.anchor.offset===r){o[r-1].remove(),o[r-2].remove();let l=fe();return this.insertAfter(l,n),l}let{anchor:i,focus:s}=e,a=(i.isBefore(s)?i:s).getNode();if(Q(a)){let l=Li(a),c=[];for(;;)if(An(l))c.push(wo()),l=l.getNextSibling();else{if(!Nt(l))break;{let _=0,b=l.getTextContent(),y=l.getTextContentSize();for(;_<y&&b[_]===" ";)_++;if(_!==0&&c.push(jf(" ".repeat(_))),_!==y)break;l=l.getNextSibling()}}let d=a.splitText(i.offset)[0],u=i.offset===0?0:1,p=d.getIndexWithinParent()+u,f=a.getParentOrThrow(),h=[Eo(),...c];f.splice(p,0,h);let m=c[c.length-1];m?m.select():i.offset===0?d.selectPrevious():d.getNextSibling().selectNext(0,0)}if(Oo(a)){let{offset:l}=e.anchor;a.splice(l,0,[Eo()]),a.select(l+1,l+1)}return null}canIndent(){return!1}collapseAtStart(){let e=fe();return this.getChildren().forEach((n=>e.append(n))),this.replace(e),!0}setLanguage(e){let n=this.getWritable();return n.__language=e||void 0,n.__isSyntaxHighlightSupported=rA(e),n}getLanguage(){return this.getLatest().__language}getIsSyntaxHighlightSupported(){return this.getLatest().__isSyntaxHighlightSupported}};function gl(t){return Tt(new Ai(t))}function Oo(t){return t instanceof Ai}function iA(t){return{node:gl(t.getAttribute(nd))}}function rV(t){let e=t,n=aA(e);return n||(function(o){let r=o.parentElement;for(;r!==null;){if(aA(r))return!0;r=r.parentElement}return!1})(e)?{node:n?gl():null}:{node:null}}function iV(){return{node:gl()}}function sA(){return{node:null}}function aA(t){return t.style.fontFamily.match("monospace")!==null}function _v(t){return t.classList.contains("js-file-line-container")}var Cv="javascript",hA={c:"C",clike:"C-like",cpp:"C++",css:"CSS",html:"HTML",java:"Java",js:"JavaScript",markdown:"Markdown",objc:"Objective-C",plain:"Plain Text",powershell:"PowerShell",py:"Python",rust:"Rust",sql:"SQL",swift:"Swift",typescript:"TypeScript",xml:"XML"},gA={cpp:"cpp",java:"java",javascript:"js",md:"markdown",plaintext:"plain",python:"py",text:"plain",ts:"typescript"};function mA(t){return gA[t]||t}function sV(t){let e=mA(t);return hA[e]||e}var aV=()=>Cv,lV=()=>Object.keys(fo.languages).filter((t=>typeof fo.languages[t]!="function")).sort(),Ls=class t extends Ft{constructor(e="",n,o){super(e,o),this.__highlightType=n}static getType(){return"code-highlight"}static clone(e){return new t(e.__text,e.__highlightType||void 0,e.__key)}getHighlightType(){return this.getLatest().__highlightType}setHighlightType(e){let n=this.getWritable();return n.__highlightType=e||void 0,n}canHaveFormat(){return!1}createDOM(e){let n=super.createDOM(e),o=bv(e.theme,this.__highlightType);return Ve(n,o),n}updateDOM(e,n,o){let r=super.updateDOM(e,n,o),i=bv(o.theme,e.__highlightType),s=bv(o.theme,this.__highlightType);return i!==s&&(i&&Fn(n,i),s&&Ve(n,s)),r}static importJSON(e){return jf().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setHighlightType(e.highlightType)}exportJSON(){return{...super.exportJSON(),highlightType:this.getHighlightType()}}setFormat(e){return this}isParentRequired(){return!0}createParentElementNode(){return gl()}};function bv(t,e){return e&&t&&t.codeHighlight&&t.codeHighlight[e]}function jf(t="",e){return Tt(new Ls(t,e))}function Nt(t){return t instanceof Ls}function _A(t,e){let n=t;for(let o=xn(t,e);o&&(Nt(o.origin)||An(o.origin));o=fO(o))n=o.origin;return n}function Li(t){return _A(t,"previous")}function As(t){return _A(t,"next")}var bA={defaultLanguage:Cv,tokenize(t,e){return fo.tokenize(t,fo.languages[e||""]||fo.languages[this.defaultLanguage])}};function Ev(t,e){let n=null,o=null,r=t,i=e,s=t.getTextContent();for(;;){if(i===0){if(r=r.getPreviousSibling(),r===null)break;if(Nt(r)||An(r)||qe(r)||Uf(167),qe(r)){n={node:r,offset:1};break}i=Math.max(0,r.getTextContentSize()-1),s=r.getTextContent()}else i--;let l=s[i];Nt(r)&&l!==" "&&(o={node:r,offset:i})}if(o!==null)return o;let a=null;if(e<t.getTextContentSize())Nt(t)&&(a=t.getTextContent()[e]);else{let l=t.getNextSibling();Nt(l)&&(a=l.getTextContent()[0])}if(a!==null&&a!==" ")return n;{let l=(function(c,d){let u=c,p=d,f=c.getTextContent(),h=c.getTextContentSize();for(;;){if(!Nt(u)||p===h){if(u=u.getNextSibling(),u===null||qe(u))return null;Nt(u)&&(p=0,f=u.getTextContent(),h=u.getTextContentSize())}if(Nt(u)){if(f[p]!==" ")return{node:u,offset:p};p++}}})(t,e);return l!==null?l:n}}function wv(t){let e=As(t);return qe(e)&&Uf(168),e}function lA(t,e,n){let o=t.getParent();Oo(o)?yA(o,e,n):Nt(t)&&t.replace(vt(t.__text))}function cV(t,e){let n=e.getElementByKey(t.getKey());if(n===null)return;let o=t.getChildren(),r=o.length;if(r===n.__cachedChildrenLength)return;n.__cachedChildrenLength=r;let i="1",s=1;for(let a=0;a<r;a++)qe(o[a])&&(i+=`
|
|
126
|
-
`+ ++s);n.setAttribute("data-gutter",i)}var yv=new Set;function yA(t,e,n){let o=t.getKey();yv.has(o)||(yv.add(o),t.getLanguage()===void 0&&t.setLanguage(n.defaultLanguage),e.update((()=>{(function(r,i){let s=St(r);if(!Oo(s)||!s.isAttached())return;let a=$();if(!F(a))return void i();let l=a.anchor,c=l.offset,d=l.type==="element"&&qe(s.getChildAtIndex(l.offset-1)),u=0;if(!d){let p=l.getNode();u=c+p.getPreviousSiblings().reduce(((f,h)=>f+h.getTextContentSize()),0)}if(i()){if(d)return void l.getNode().select(c,c);s.getChildren().some((p=>{let f=Q(p);if(f||qe(p)){let h=p.getTextContentSize();if(f&&h>=u)return p.select(u,u),!0;u-=h}return!1}))}})(o,(()=>{let r=St(o);if(!Oo(r)||!r.isAttached())return!1;let i=r.getLanguage()||n.defaultLanguage,s=/^diff-([\w-]+)/i.exec(i),a=r.getTextContent(),l=n.tokenize(a,s?"diff":i);s&&(l=(function(h,m){let _=m,b=fo.languages[_],y={tokens:h},x=fo.languages.diff.PREFIXES;for(let v of y.tokens){if(typeof v=="string"||!(v.type in x)||!Array.isArray(v.content))continue;let E=v.type,C=0,k=()=>(C++,new fo.Token("prefix",x[E],E.replace(/^(\w+).*/,"$1"))),T=v.content.filter((M=>typeof M=="string"||M.type!=="prefix")),w=v.content.length-T.length,S=fo.tokenize(xv(T),b);S.unshift(k());let N=/\r\n|\n/g,D=M=>{let I=[];N.lastIndex=0;let L,K=0;for(;C<w&&(L=N.exec(M));){let W=L.index+L[0].length;I.push(M.slice(K,W)),K=W,I.push(k())}if(I.length!==0)return K<M.length&&I.push(M.slice(K)),I},O=M=>{for(let I=0;I<M.length&&C<w;I++){let L=M[I];if(typeof L=="string"){let K=D(L);K&&(M.splice(I,1,...K),I+=K.length-1)}else if(typeof L.content=="string"){let K=D(L.content);K&&(L.content=K)}else Array.isArray(L.content)?O(L.content):O([L.content])}};O(S),C<w&&S.push(k()),v.content=S}return y.tokens})(l,s[1]));let c=vv(l),d=(function(h,m){let _=0;for(;_<h.length&&cA(h[_],m[_]);)_++;let b=h.length,y=m.length,x=Math.min(b,y)-_,v=0;for(;v<x;)if(v++,!cA(h[b-v],m[y-v])){v--;break}let E=_,C=b-v,k=m.slice(_,y-v);return{from:E,nodesForReplacement:k,to:C}})(r.getChildren(),c),{from:u,to:p,nodesForReplacement:f}=d;return!(u===p&&!f.length)&&(t.splice(u,p-u,f),!0)}))}),{onUpdate:()=>{yv.delete(o)},skipTransforms:!0}))}function vv(t,e){let n=[];for(let o of t)if(typeof o=="string"){let r=o.split(/(\n|\t)/),i=r.length;for(let s=0;s<i;s++){let a=r[s];a===`
|
|
127
|
-
`||a===`\r
|
|
128
|
-
`?n.push(Eo()):a===" "?n.push(wo()):a.length>0&&n.push(jf(a,e))}}else{let{content:r,alias:i}=o;typeof r=="string"?n.push(...vv([r],o.type==="prefix"&&typeof i=="string"?i:o.type)):Array.isArray(r)&&n.push(...vv(r,o.type==="unchanged"?void 0:o.type))}return n}function cA(t,e){return Nt(t)&&Nt(e)&&t.__text===e.__text&&t.__highlightType===e.__highlightType||An(t)&&An(e)||qe(t)&&qe(e)}function Ms(t){if(!F(t))return!1;let e=t.anchor.getNode(),n=Oo(e)?e:e.getParent(),o=t.focus.getNode(),r=Oo(o)?o:o.getParent();return Oo(n)&&n.is(r)}function xA(t){let e=t.getNodes(),n=[];if(e.length===1&&Oo(e[0]))return n;let o=[];for(let r=0;r<e.length;r++){let i=e[r];Nt(i)||An(i)||qe(i)||Uf(169),qe(i)?o.length>0&&(n.push(o),o=[]):o.push(i)}if(o.length>0){let r=t.isBackward()?t.anchor:t.focus,i=Go(o[0].getKey(),0,"text");r.is(i)||n.push(o)}return n}function dA(t){let e=$();if(!F(e)||!Ms(e))return!1;let n=xA(e),o=n.length;if(o===0&&e.isCollapsed())return t===Ln&&e.insertNodes([wo()]),!0;if(o===0&&t===Ln&&e.getTextContent()===`
|
|
129
|
-
`){let r=wo(),i=Eo(),s=e.isBackward()?"previous":"next";return e.insertNodes([r,i]),Kp(q1(Fp(Q1(r,"next",0),Jo(xn(i,"next"))),s)),!0}for(let r=0;r<o;r++){let i=n[r];if(i.length>0){let s=i[0];if(r===0&&(s=Li(s)),t===Ln){let a=wo();if(s.insertBefore(a),r===0){let l=e.isBackward()?"focus":"anchor",c=Go(s.getKey(),0,"text");e[l].is(c)&&e[l].set(a.getKey(),0,"text")}}else An(s)&&s.remove()}}return!0}function uA(t,e){let n=$();if(!F(n))return!1;let{anchor:o,focus:r}=n,i=o.offset,s=r.offset,a=o.getNode(),l=r.getNode(),c=t===So;if(!Ms(n)||!Nt(a)&&!An(a)||!Nt(l)&&!An(l))return!1;if(!e.altKey){if(n.isCollapsed()){let b=a.getParentOrThrow();if(c&&i===0&&a.getPreviousSibling()===null){if(b.getPreviousSibling()===null)return b.selectPrevious(),e.preventDefault(),!0}else if(!c&&i===a.getTextContentSize()&&a.getNextSibling()===null&&b.getNextSibling()===null)return b.selectNext(),e.preventDefault(),!0}return!1}let d,u;if(a.isBefore(l)?(d=Li(a),u=As(l)):(d=Li(l),u=As(a)),d==null||u==null)return!1;let p=d.getNodesBetween(u);for(let b=0;b<p.length;b++){let y=p[b];if(!Nt(y)&&!An(y)&&!qe(y))return!1}e.preventDefault(),e.stopPropagation();let f=c?d.getPreviousSibling():u.getNextSibling();if(!qe(f))return!0;let h=c?f.getPreviousSibling():f.getNextSibling();if(h==null)return!0;let m=Nt(h)||An(h)||qe(h)?c?Li(h):As(h):null,_=m??h;return f.remove(),p.forEach((b=>b.remove())),t===So?(p.forEach((b=>_.insertBefore(b))),_.insertBefore(f)):(_.insertAfter(f),_=f,p.forEach((b=>{_.insertAfter(b),_=b}))),n.setTextNodeRange(a,i,l,s),!0}function pA(t,e){let n=$();if(!F(n))return!1;let{anchor:o,focus:r}=n,i=o.getNode(),s=r.getNode(),a=t===Qp;if(!Ms(n)||!Nt(i)&&!An(i)||!Nt(s)&&!An(s))return!1;if(a){let l=Ev(s,r.offset);if(l!==null){let{node:c,offset:d}=l;qe(c)?c.selectNext(0,0):n.setTextNodeRange(c,d,c,d)}else s.getParentOrThrow().selectStart()}else wv(s).select();return e.preventDefault(),e.stopPropagation(),!0}function dV(t,e){if(!t.hasNodes([Ai,Ls]))throw new Error("CodeHighlightPlugin: CodeNode or CodeHighlightNode not registered on editor");e==null&&(e=bA);let n=[];return t._headless!==!0&&n.push(t.registerMutationListener(Ai,(o=>{t.update((()=>{for(let[r,i]of o)if(i!=="destroyed"){let s=St(r);s!==null&&cV(s,t)}}))}),{skipInitialization:!1})),n.push(t.registerNodeTransform(Ai,(o=>yA(o,t,e))),t.registerNodeTransform(Ft,(o=>lA(o,t,e))),t.registerNodeTransform(Ls,(o=>lA(o,t,e))),t.registerCommand(Ei,(o=>{let r=(function(i){let s=$();if(!F(s)||!Ms(s))return null;let a=i?uo:Ln,l=i?uo:xs,c=s.anchor,d=s.focus;if(c.is(d))return l;let u=xA(s);if(u.length!==1)return a;let p=u[0],f,h;p.length===0&&Uf(285),s.isBackward()?(f=d,h=c):(f=c,h=d);let m=Li(p[0]),_=As(p[0]),b=Go(m.getKey(),0,"text"),y=Go(_.getKey(),_.getTextContentSize(),"text");return f.isBefore(b)||y.isBefore(h)?a:b.isBefore(f)||h.isBefore(y)?l:a})(o.shiftKey);return r!==null&&(o.preventDefault(),t.dispatchCommand(r,void 0),!0)}),Ae),t.registerCommand(xs,(()=>!!Ms($())&&(To([wo()]),!0)),Ae),t.registerCommand(Ln,(o=>dA(Ln)),Ae),t.registerCommand(uo,(o=>dA(uo)),Ae),t.registerCommand(So,(o=>{let r=$();if(!F(r))return!1;let{anchor:i}=r,s=i.getNode();return!!Ms(r)&&(r.isCollapsed()&&i.offset===0&&s.getPreviousSibling()===null&&Oo(s.getParentOrThrow())?(o.preventDefault(),!0):uA(So,o))}),Ae),t.registerCommand(Rr,(o=>{let r=$();if(!F(r))return!1;let{anchor:i}=r,s=i.getNode();return!!Ms(r)&&(r.isCollapsed()&&i.offset===s.getTextContentSize()&&s.getNextSibling()===null&&Oo(s.getParentOrThrow())?(o.preventDefault(),!0):uA(Rr,o))}),Ae),t.registerCommand(Qp,(o=>pA(Qp,o)),Ae),t.registerCommand(Oy,(o=>pA(Oy,o)),Ae)),Be(...n)}var uV=Li,pV=As,fV=wv,hV=Ev;var dt=Tv,Xse=dt.$createCodeHighlightNode,od=dt.$createCodeNode,Zse=dt.$getEndOfCodeInLine,Qse=dt.$getFirstCodeNodeOfLine,eae=dt.$getLastCodeNodeOfLine,tae=dt.$getStartOfCodeInLine,vA=dt.$isCodeHighlightNode,Sv=dt.$isCodeNode,nae=dt.CODE_LANGUAGE_FRIENDLY_NAME_MAP,oae=dt.CODE_LANGUAGE_MAP,rae=dt.CodeHighlightNode,CA=dt.CodeNode,iae=dt.DEFAULT_CODE_LANGUAGE,sae=dt.PrismTokenizer,aae=dt.getCodeLanguages,lae=dt.getDefaultCodeLanguage,cae=dt.getEndOfCodeInLine,dae=dt.getFirstCodeNodeOfLine,uae=dt.getLanguageFriendlyName,pae=dt.getLastCodeNodeOfLine,fae=dt.getStartOfCodeInLine,hae=dt.normalizeCodeLang,gae=dt.registerCodeHighlighting;Hs();ke();var Xt=Object.freeze({NORMAL:Et?"\u2318+Opt+0":"Ctrl+Alt+0",HEADING1:Et?"\u2318+Opt+1":"Ctrl+Alt+1",HEADING2:Et?"\u2318+Opt+2":"Ctrl+Alt+2",HEADING3:Et?"\u2318+Opt+3":"Ctrl+Alt+3",NUMBERED_LIST:Et?"\u2318+Shift+7":"Ctrl+Shift+7",BULLET_LIST:Et?"\u2318+Shift+8":"Ctrl+Shift+8",STRIKETHROUGH:Et?"\u2318+Shift+X":"Ctrl+Shift+X",SUBSCRIPT:Et?"\u2318+,":"Ctrl+,",SUPERSCRIPT:Et?"\u2318+.":"Ctrl+.",INDENT:Et?"\u2318+]":"Ctrl+]",OUTDENT:Et?"\u2318+[":"Ctrl+[",CLEAR_FORMATTING:Et?"\u2318+\\":"Ctrl+\\",REDO:Et?"\u2318+Shift+Z":"Ctrl+Y",UNDO:Et?"\u2318+Z":"Ctrl+Z",BOLD:Et?"\u2318+B":"Ctrl+B",ITALIC:Et?"\u2318+I":"Ctrl+I",UNDERLINE:Et?"\u2318+U":"Ctrl+U",INSERT_LINK:Et?"\u2318+K":"Ctrl+K"}),Io={ctrlKey:!Et,metaKey:Et};function EA(t){let{code:e}=t;return(e==="Numpad0"||e==="Digit0")&&Pn(t,{...Io,altKey:!0})}function wA(t){let{code:e}=t,n=e[e.length-1];return["1","2","3","4","5"].includes(n)&&Pn(t,{...Io,altKey:!0})}function TA(t){let{code:e}=t;return(e==="Numpad7"||e==="Digit7")&&Pn(t,{...Io,shiftKey:!0})}function SA(t){let{code:e}=t;return(e==="Numpad8"||e==="Digit8")&&Pn(t,{...Io,shiftKey:!0})}function kA(t){let{code:e}=t;return e==="KeyX"&&Pn(t,{...Io,shiftKey:!0})}function NA(t){let{code:e}=t;return e==="BracketRight"&&Pn(t,Io)}function DA(t){let{code:e}=t;return e==="BracketLeft"&&Pn(t,Io)}function OA(t){let{code:e}=t;return e==="Comma"&&Pn(t,Io)}function IA(t){let{code:e}=t;return e==="Period"&&Pn(t,Io)}function MA(t){let{code:e}=t;return e==="Backslash"&&Pn(t,Io)}function AA(t){let{code:e}=t;return e==="KeyK"&&Pn(t,Io)}var Rs=t=>{t.update(()=>{let e=$();nf(e,()=>fe())})},Ri=(t,e,n)=>{e!==n&&t.update(()=>{let o=$();nf(o,()=>Ss(n))})},Vf=(t,e)=>{e!=="bullet"?t.dispatchCommand($O,void 0):Rs(t)},Wf=(t,e)=>{console.log("formatNumberedList"),e!=="number"?t.dispatchCommand(BO,void 0):Rs(t)},ml=t=>{t.update(()=>{let e=$();if(F(e)){let n=e.anchor,o=e.focus,r=e.getNodes(),i=e.extract();if(n.key===o.key&&n.offset===o.offset)return;r.forEach((s,a)=>{if(Q(s)){let l=s;a===0&&n.offset!==0&&(l=l.splitText(n.offset)[1]||l),a===r.length-1&&(l=l.splitText(o.offset)[0]||l);let c=i[0];r.length===1&&Q(c)&&(l=c),l.__style!==""&&l.setStyle(""),l.__format!==0&&l.setFormat(0);let d=Cs(l);d.__format!==0&&d.setFormat(""),d.__indent!==0&&d.setIndent(0)}else Fr(s)||Br(s)?s.replace(fe(),!0):XM(s)&&s.setFormat("")})}})},LA=(t,e)=>{e!=="quote"?t.update(()=>{let n=$();nf(n,()=>ks())}):Rs(t)};Hs();var gV=new Set(["http:","https:","mailto:","sms:","tel:"]);function RA(t){try{let e=new URL(t);if(!gV.has(e.protocol))return"about:blank"}catch{return t}return t}var Dae=new RegExp(/((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=+$,\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=+$,\w]+@)[A-Za-z0-9.-]+)((?:\/[+~%/.\w-_]*)?\??(?:[-+=&;%@.\w_]*)#?(?:[\w]*))?)/);function Qn(t){return t?"active dropdown-item-active":""}function rr(t){let{blockType:e}=t;return e==="paragraph"?g(CC,{size:16}):e==="h1"?g(PC,{size:16}):e==="h2"?g(FC,{size:16}):e==="h3"?g(BC,{size:16}):e==="h4"?g($C,{size:16}):e==="h5"?g(zC,{size:16}):e==="number"?g(WC,{size:16}):e==="bullet"?g(GC,{size:16}):e==="quote"?g(tE,{size:16}):null}function mV(t){let{editor:e,blockType:n}=t;return g(X,{control:g(ee,{className:Se("LexicalEditor__toolbar__dropdown","LexicalEditor__toolbar__blockFormatDropdown"),variant:"default",compact:!0,leftIcon:g(rr,{blockType:n}),rightIcon:g(to,{size:16}),children:Ff[n]}),children:[g(X.Item,{icon:g(rr,{blockType:"paragraph"}),className:Qn(n==="paragraph"),onClick:()=>Rs(e),children:"Normal"}),g(X.Item,{icon:g(rr,{blockType:"bullet"}),className:Qn(n==="bullet"),onClick:()=>Vf(e,n),children:"Bullet List"}),g(X.Item,{icon:g(rr,{blockType:"number"}),className:Qn(n==="number"),onClick:()=>Wf(e,n),children:"Numbered List"}),g(X.Item,{icon:g(rr,{blockType:"h1"}),className:Qn(n==="h1"),onClick:()=>Ri(e,n,"h1"),children:"Heading 1"}),g(X.Item,{icon:g(rr,{blockType:"h2"}),className:Qn(n==="h2"),onClick:()=>Ri(e,n,"h2"),children:"Heading 2"}),g(X.Item,{icon:g(rr,{blockType:"h3"}),className:Qn(n==="h3"),onClick:()=>Ri(e,n,"h3"),children:"Heading 3"}),g(X.Item,{icon:g(rr,{blockType:"h4"}),className:Qn(n==="h4"),onClick:()=>Ri(e,n,"h4"),children:"Heading 4"}),g(X.Item,{icon:g(rr,{blockType:"h5"}),className:Qn(n==="h5"),onClick:()=>Ri(e,n,"h5"),children:"Heading 5"}),g(X.Item,{icon:g(rr,{blockType:"quote"}),className:Qn(n==="quote"),onClick:()=>LA(e,n),children:"Quote"})]})}function rd(){return g("div",{className:"divider"})}function _V(t){let{editor:e,isStrikethrough:n,isSuperscript:o,isSubscript:r,isCode:i}=t;return g(X,{styles:{body:{minWidth:"240px"}},control:g(De,{className:Se("LexicalEditor__toolbar__actionIcon",(n||o||r||i)&&"LexicalEditor__toolbar__actionIcon--active"),label:"More formatting",position:"top",withArrow:!0,children:g(Pe,{variant:"default",title:"More formatting",children:g(to,{size:16})})}),children:[g(X.Item,{icon:g(Od,{size:16}),className:Qn(n),onClick:()=>{e.dispatchCommand(ot,"strikethrough")},children:["Strikethrough (",Xt.STRIKETHROUGH,")"]}),g(X.Item,{icon:g(Md,{size:16}),className:Qn(o),onClick:()=>{e.dispatchCommand(ot,"superscript")},children:["Superscript (",Xt.SUPERSCRIPT,")"]}),g(X.Item,{icon:g(Id,{size:16}),className:Qn(r),onClick:()=>{e.dispatchCommand(ot,"subscript")},children:["Subscript (",Xt.SUBSCRIPT,")"]}),g(X.Item,{icon:g(vd,{size:16}),className:Qn(i),onClick:()=>{e.dispatchCommand(ot,"code")},children:"Code"})]})}function PA(t){let{editor:e,blockComponents:n,inlineComponents:o,activeEditor:r,setActiveEditor:i,setIsLinkEditMode:s,variant:a="document",onInsertBlockComponent:l,onInsertInlineComponent:c}=t,[d,u]=R(()=>e.isEditable()),{toolbarState:p,updateToolbarState:f}=Bf(),h=we(()=>{let v=$();if(F(v)){if(r!==e&&gO(r)){let O=r.getRootElement();f("isImageCaption",!!O?.parentElement?.classList.contains("image-caption-container"))}else f("isImageCaption",!1);let E=v.anchor.getNode(),C=E.getKey()==="root"?E:le(E,O=>{let M=O.getParent();return M!==null&&Rt(M)});C===null&&(C=E.getTopLevelElementOrThrow());let k=C.getKey(),T=r.getElementByKey(k);f("isRTL",GD(v));let w=Kr(v),S=w.getParent(),N=Je(S)||Je(w);if(f("isLink",N),f("rootType","root"),T!==null)if(vn(C)){let O=af(E,tr),M=O?O.getListType():C.getListType();f("blockType",M)}else{let O=Fr(C)?C.getTag():C.getType();O in Ff&&f("blockType",O)}let D;Je(S)&&(D=le(w,O=>G(O)&&!O.isInline())),f("elementFormat",G(D)?D.getFormatType():G(w)?w.getFormatType():S?.getFormatType()||"left")}F(v)&&(f("isBold",v.hasFormat("bold")),f("isItalic",v.hasFormat("italic")),f("isUnderline",v.hasFormat("underline")),f("isStrikethrough",v.hasFormat("strikethrough")),f("isSuperscript",v.hasFormat("superscript")),f("isSubscript",v.hasFormat("subscript")),f("isCode",v.hasFormat("code")))},[r,e,f]);P(()=>e.registerCommand(cn,(v,E)=>(i(E),h(),!1),Ct),[e,h,i]),P(()=>{r.getEditorState().read(()=>{h()})},[r,h]),P(()=>Be(e.registerEditableListener(v=>{u(v)}),r.registerUpdateListener(({editorState:v})=>{v.read(()=>{h()})}),r.registerCommand(ys,v=>(f("canUndo",v),!1),Ct),r.registerCommand(bs,v=>(f("canRedo",v),!1),Ct)),[h,r,e,f]);let m=we(()=>{p.isLink?(s(!1),r.dispatchCommand(Bn,null)):(s(!0),r.dispatchCommand(Bn,RA("https://")))},[r,s,p.isLink]),_=J(()=>n?[...n].sort((v,E)=>{let C=v.label||v.name,k=E.label||E.name;return C.localeCompare(k)}):[],[n]),b=J(()=>o?[...o].sort((v,E)=>{let C=v.label||v.name,k=E.label||E.name;return C.localeCompare(k)}):[],[o]),y=v=>{switch(v){case"image":return g(XC,{size:16});case"html":return g(EC,{size:16});default:break}return g(iE,{size:16})},x=a==="comment";return g("div",{className:Se("LexicalEditor__toolbar",x&&"LexicalEditor__toolbar--comment"),children:[!x&&p.blockType in Ff&&r===e&&g(Me,{children:[g(mV,{disabled:!d,blockType:p.blockType,rootType:p.rootType,editor:r}),g(rd,{})]}),g(Me,{children:[g("div",{className:"LexicalEditor__toolbar__group",children:[g(En,{tooltip:`Bold (${Xt.BOLD})`,active:p.isBold,onClick:()=>{r.dispatchCommand(ot,"bold")},children:g(bd,{size:16})}),g(En,{tooltip:`Italic (${Xt.ITALIC})`,active:p.isItalic,onClick:()=>{r.dispatchCommand(ot,"italic")},children:g(wd,{size:16})}),g(En,{tooltip:`Underline (${Xt.UNDERLINE})`,active:p.isUnderline,onClick:()=>{r.dispatchCommand(ot,"underline")},children:g(Ld,{size:16})}),g(_V,{editor:r,isStrikethrough:p.isStrikethrough,isSuperscript:p.isSuperscript,isSubscript:p.isSubscript,isCode:p.isCode})]}),g(rd,{}),g("div",{className:"LexicalEditor__toolbar__group",children:g(En,{tooltip:`Insert link (${Xt.INSERT_LINK})`,active:p.isLink,onClick:m,children:g(Td,{size:16})})}),g(rd,{}),g(En,{tooltip:`Clear formatting (${Xt.CLEAR_FORMATTING})`,onClick:()=>{ml(r)},children:g(yd,{size:16})}),g(rd,{}),!x&&g(Me,{children:[g(X,{control:g(ee,{className:Se("LexicalEditor__toolbar__dropdown","LexicalEditor__toolbar__insertDropdown"),variant:"default",compact:!0,leftIcon:g(eE,{size:16}),rightIcon:g(to,{size:16}),children:"Components"}),children:[g(X.Label,{children:"Insert"}),g(X.Item,{icon:g(Ad,{size:16}),onClick:()=>{r.dispatchCommand(yM,{columns:"3",rows:"3"})},children:"Table"}),g(X.Item,{icon:g(rE,{size:16}),onClick:()=>{r.dispatchCommand(xf,void 0)},children:"Horizontal Rule"}),b.length>0&&g(Me,{children:[g(X.Label,{children:"Inline Components"}),b.map(v=>g(X.Item,{icon:g(wC,{size:16}),onClick:()=>c?.(v.name),children:v.label||v.name},v.name))]}),_.length>0&&g(Me,{children:[g(X.Label,{children:"Block Components"}),_.map(v=>g(X.Item,{icon:y(v.name),onClick:()=>l?.(v.name),children:v.label||v.name},v.name))]})]}),g(rd,{})]})]})]})}function En(t){return g(De,{className:Se("LexicalEditor__toolbar__actionIcon",t.active&&"LexicalEditor__toolbar__actionIcon--active"),label:t.tooltip,position:"top",withArrow:!0,children:g(Pe,{variant:t.variant||"default",onClick:t.onClick,title:t.tooltip,children:t.children})})}var bV=12,yV=5;function xV(t){let{editor:e,anchorElem:n,isLink:o,isBold:r,isCode:i,isItalic:s,isUnderline:a,isStrikethrough:l,isSubscript:c,isSuperscript:d,setIsLinkEditMode:u}=t,p=Y(null),f=we(()=>{o?(u(!1),e.dispatchCommand(Bn,null)):(u(!0),e.dispatchCommand(Bn,""))},[e,o,u]);function h(b){if(p?.current&&(b.buttons===1||b.buttons===3)&&p.current.style.pointerEvents!=="none"){let y=b.clientX,x=b.clientY,v=document.elementFromPoint(y,x);p.current.contains(v)||(p.current.style.pointerEvents="none")}}function m(){p?.current&&p.current.style.pointerEvents!=="auto"&&(p.current.style.pointerEvents="auto")}P(()=>{if(p?.current)return document.addEventListener("mousemove",h),document.addEventListener("mouseup",m),()=>{document.removeEventListener("mousemove",h),document.removeEventListener("mouseup",m)}},[p]);let _=we(()=>{let b=$(),y=p.current,x=Jn(e._window);if(y===null)return;let v=e.getRootElement();if(b!==null&&x!==null&&!x.isCollapsed&&v!==null&&v.contains(x.anchorNode)){let E=tA(x,v);CV(E,y,n,o)}},[e,n,o]);return P(()=>{let b=n.parentElement,y=()=>{e.getEditorState().read(()=>{_()})};return window.addEventListener("resize",y),b&&b.addEventListener("scroll",y),()=>{window.removeEventListener("resize",y),b&&b.removeEventListener("scroll",y)}},[e,_,n]),P(()=>(e.getEditorState().read(()=>{_()}),Be(e.registerUpdateListener(({editorState:b})=>{b.read(()=>{_()})}),e.registerCommand(cn,()=>(_(),!1),Ae))),[e,_]),g("div",{ref:p,className:"LexicalEditor__floatingToolbar",children:e.isEditable()&&g(Me,{children:[g(En,{variant:"hover",tooltip:`Bold (${Xt.BOLD})`,active:r,onClick:()=>{e.dispatchCommand(ot,"bold")},children:g(bd,{size:16})}),g(En,{variant:"hover",tooltip:`Italic (${Xt.ITALIC})`,active:s,onClick:()=>{e.dispatchCommand(ot,"italic")},children:g(wd,{size:16})}),g(En,{variant:"hover",tooltip:`Underline (${Xt.UNDERLINE})`,active:a,onClick:()=>{e.dispatchCommand(ot,"underline")},children:g(Ld,{size:16})}),g(En,{variant:"hover",tooltip:`Strikethrough (${Xt.STRIKETHROUGH})`,active:l,onClick:()=>{e.dispatchCommand(ot,"strikethrough")},children:g(Od,{size:16})}),g(En,{variant:"hover",tooltip:`Superscript (${Xt.SUPERSCRIPT})`,active:d,onClick:()=>{e.dispatchCommand(ot,"superscript")},children:g(Md,{size:16})}),g(En,{variant:"hover",tooltip:`Subscript (${Xt.SUBSCRIPT})`,active:c,onClick:()=>{e.dispatchCommand(ot,"subscript")},children:g(Id,{size:16})}),g(En,{variant:"hover",tooltip:"Code",active:i,onClick:()=>{e.dispatchCommand(ot,"code")},children:g(vd,{size:16})}),g(En,{variant:"hover",tooltip:`Insert link (${Xt.INSERT_LINK})`,active:o,onClick:f,children:g(Td,{size:16})}),g(En,{variant:"hover",tooltip:`Clear formatting (${Xt.CLEAR_FORMATTING})`,onClick:()=>{ml(e)},children:g(yd,{size:16})})]})})}function vV(t,e,n){let[o,r]=R(!1),[i,s]=R(!1),[a,l]=R(!1),[c,d]=R(!1),[u,p]=R(!1),[f,h]=R(!1),[m,_]=R(!1),[b,y]=R(!1),[x,v]=R(!1),E=we(()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let C=$(),k=Jn(t._window),T=t.getRootElement();if(k!==null&&(!F(C)||T===null||!T.contains(k.anchorNode))){r(!1);return}if(!F(C))return;let w=Kr(C);l(C.hasFormat("bold")),d(C.hasFormat("code")),p(C.hasFormat("italic")),y(C.hasFormat("underline")),h(C.hasFormat("strikethrough")),_(C.hasFormat("subscript")),v(C.hasFormat("superscript"));let S=w.getParent();Je(S)||Je(w)?s(!0):s(!1),!vA(C.anchor.getNode())&&C.getTextContent()!==""?r(Q(w)||qt(w)):r(!1);let N=C.getTextContent().replace(/\n/g,"");if(!C.isCollapsed()&&N===""){r(!1);return}})},[t]);return P(()=>(document.addEventListener("selectionchange",E),()=>{document.removeEventListener("selectionchange",E)}),[E]),P(()=>Be(t.registerUpdateListener(()=>{E()}),t.registerRootListener(()=>{t.getRootElement()===null&&r(!1)})),[t,E]),o?Yr(g(xV,{editor:t,anchorElem:e,isLink:i,isBold:a,isCode:c,isItalic:u,isStrikethrough:f,isSubscript:m,isSuperscript:x,isUnderline:b,setIsLinkEditMode:n}),e):null}function FA(t){let{anchorElem:e=document.body,setIsLinkEditMode:n}=t,[o]=be();return vV(o,e,n)}function CV(t,e,n,o=!1,r=bV,i=yV){let s=n.parentElement;if(t===null||!s){e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)";return}let a=e.getBoundingClientRect(),l=n.getBoundingClientRect(),c=s.getBoundingClientRect(),d=t.top-a.height-r,u=t.left-i,p=window.getSelection();if(p&&p.rangeCount>0){let h=p.getRangeAt(0).startContainer;if(h.nodeType===Node.ELEMENT_NODE||h.parentElement){let m=h.nodeType===Node.ELEMENT_NODE?h:h.parentElement,_=window.getComputedStyle(m).textAlign;(_==="right"||_==="end")&&(u=t.right-a.width+i)}}d<c.top&&(d+=a.height+t.height+r*(o?9:2)),u+a.width>c.right&&(u=c.right-a.width-i),u<c.left&&(u=c.left+i),d-=l.top,u-=l.left,e.style.opacity="1",e.style.transform=`translate(${u}px, ${d}px)`}ke();function BA(){let[t]=be();P(()=>t.registerCommand(wi,n=>{let{clipboardData:o}=n;if(!o)return!1;let i=Array.from(o.files).find(s=>s.type.startsWith("image/"));return i?(n.preventDefault(),e(i),!0):!1},Ae),[t]);let e=async n=>{let o=URL.createObjectURL(n),r=null;t.update(()=>{let i=Is("image",{file:{src:o,width:0,height:0},loading:!0}),s=$();if(F(s)){To([i]);let a=fe();i.insertAfter(a),a.select()}r=i.getKey()});try{let i=await Js(n);t.update(()=>{if(r){let s=St(r);Hr(s)&&s.setBlockData({file:i,loading:!1})}})}catch(i){console.error("Failed to upload image",i),ve({type:"error",message:"Failed to upload image"})}};return null}var Mv={};Re(Mv,{$convertFromMarkdownString:()=>RV,$convertToMarkdownString:()=>PV,BOLD_ITALIC_STAR:()=>oL,BOLD_ITALIC_UNDERSCORE:()=>rL,BOLD_STAR:()=>iL,BOLD_UNDERSCORE:()=>sL,CHECK_LIST:()=>LV,CODE:()=>ZA,ELEMENT_TRANSFORMERS:()=>uL,HEADING:()=>JA,HIGHLIGHT:()=>nL,INLINE_CODE:()=>tL,ITALIC_STAR:()=>lL,ITALIC_UNDERSCORE:()=>cL,LINK:()=>dL,MULTILINE_ELEMENT_TRANSFORMERS:()=>pL,ORDERED_LIST:()=>eL,QUOTE:()=>XA,STRIKETHROUGH:()=>aL,TEXT_FORMAT_TRANSFORMERS:()=>fL,TEXT_MATCH_TRANSFORMERS:()=>hL,TRANSFORMERS:()=>Xf,UNORDERED_LIST:()=>QA,registerMarkdownShortcuts:()=>OV});function kv(t,e){let n={};for(let o of t){let r=e(o);r&&(n[r]?n[r].push(o):n[r]=[o])}return n}function Ov(t){let e=kv(t,(n=>n.type));return{element:e.element||[],multilineElement:e["multiline-element"]||[],textFormat:e["text-format"]||[],textMatch:e["text-match"]||[]}}var Yf=/[!-/:-@[-`{-~\s]/,EV=/^\s{0,3}$/;function Nv(t){if(!qt(t))return!1;let e=t.getFirstChild();return e==null||t.getChildrenSize()===1&&Q(e)&&EV.test(e.getTextContent())}function wV(t,e,n,o){for(let r of e){if(!r.export)continue;let i=r.export(t,(s=>qf(s,n,o)));if(i!=null)return i}return G(t)?qf(t,n,o):Mn(t)?t.getTextContent():null}function qf(t,e,n,o,r){let i=[],s=t.getChildren();o||(o=[]),r||(r=[]);e:for(let a of s){for(let l of n){if(!l.export)continue;let c=l.export(a,(d=>qf(d,e,n,o,[...r,...o])),((d,u)=>$A(d,u,e,o,r)));if(c!=null){i.push(c);continue e}}qe(a)?i.push(`
|
|
130
|
-
`):Q(a)?i.push($A(a,a.getTextContent(),e,o,r)):G(a)?i.push(qf(a,e,n,o,r)):Mn(a)&&i.push(a.getTextContent())}return i.join("")}function $A(t,e,n,o,r){let i=t.getFormat()===0?e:(function(p){return p.replace(/^\s+|\s+$/g,(f=>[...f].map((h=>"&#"+h.codePointAt(0)+";")).join("")))})(e);t.hasFormat("code")||(i=i.replace(/([*_`~\\])/g,"\\$1"));let s="",a="",l="",c=zA(t,!0),d=zA(t,!1),u=new Set;for(let p of n){let f=p.format[0],h=p.tag;Gf(t,f)&&!u.has(f)&&(u.add(f),Gf(c,f)&&o.find((m=>m.tag===h))||(o.push({format:f,tag:h}),s+=h))}for(let p=0;p<o.length;p++){let f=Gf(t,o[p].format),h=Gf(d,o[p].format);if(f&&h)continue;let m=[...o];for(;m.length>p;){let _=m.pop();r&&_&&r.find((b=>b.tag===_.tag))||(_&&typeof _.tag=="string"&&(f?h||(l+=_.tag):a+=_.tag),o.pop())}break}return i=s+i+l,a+i}function zA(t,e){let n=e?t.getPreviousSibling():t.getNextSibling();if(!n){let o=t.getParentOrThrow();o.isInline()&&(n=e?o.getPreviousSibling():o.getNextSibling())}for(;n;){if(G(n)){if(!n.isInline())break;let o=e?n.getLastDescendant():n.getFirstDescendant();if(Q(o))return o;n=e?n.getPreviousSibling():n.getNextSibling()}if(Q(n))return n;if(!G(n))return null}return null}function Gf(t,e){return Q(t)&&t.hasFormat(e)}function TV(t,e){let n=(function(r,i){let s=r.match(i.openTagsRegExp);if(s==null)return null;for(let a of s){let l=a.replace(/^\s/,""),c=i.fullMatchRegExpByTag[l];if(c==null)continue;let d=r.match(c),u=i.transformersByTag[l];if(d!=null&&u!=null){if(u.intraword!==!1)return d;let{index:p=0}=d,f=r[p-1],h=r[p+d[0].length];if((!f||Yf.test(f))&&(!h||Yf.test(h)))return d}}return null})(t.getTextContent(),e);if(!n)return null;let o=n.index||0;return{endIndex:o+n[0].length,match:n,startIndex:o,transformer:e.transformersByTag[n[1]]}}function Ps(t){return Q(t)&&!t.hasFormat("code")}function Fs(t,e,n){let o=TV(t,e),r=(function(s,a){let l=s,c,d,u,p;for(let f of a){if(!f.replace||!f.importRegExp)continue;let h=l.getTextContent().match(f.importRegExp);if(!h)continue;let m=h.index||0,_=f.getEndIndex?f.getEndIndex(l,h):m+h[0].length;_!==!1&&(c===void 0||d===void 0||m<c&&_>d)&&(c=m,d=_,u=f,p=h)}return c===void 0||d===void 0||u===void 0||p===void 0?null:{endIndex:d,match:p,startIndex:c,transformer:u}})(t,n);if(o&&r&&(o.startIndex<=r.startIndex&&o.endIndex>=r.endIndex?r=null:o=null),o){let s=(function(a,l,c,d,u){let p=a.getTextContent(),f,h,m;if(u[0]===p?f=a:l===0?[f,h]=a.splitText(c):[m,f,h]=a.splitText(l,c),f.setTextContent(u[2]),d)for(let _ of d.format)f.hasFormat(_)||f.toggleFormat(_);return{nodeAfter:h,nodeBefore:m,transformedNode:f}})(t,o.startIndex,o.endIndex,o.transformer,o.match);Ps(s.nodeAfter)&&Fs(s.nodeAfter,e,n),Ps(s.nodeBefore)&&Fs(s.nodeBefore,e,n),Ps(s.transformedNode)&&Fs(s.transformedNode,e,n)}else if(r){let s=(function(a,l,c,d,u){let p,f,h;return l===0?[p,f]=a.splitText(c):[h,p,f]=a.splitText(l,c),d.replace?{nodeAfter:f,nodeBefore:h,transformedNode:d.replace(p,u)||void 0}:null})(t,r.startIndex,r.endIndex,r.transformer,r.match);if(!s)return;Ps(s.nodeAfter)&&Fs(s.nodeAfter,e,n),Ps(s.nodeBefore)&&Fs(s.nodeBefore,e,n),Ps(s.transformedNode)&&Fs(s.transformedNode,e,n)}let i=t.getTextContent().replace(/\\([*_`~\\])/g,"$1").replace(/&#(\d+);/g,((s,a)=>String.fromCodePoint(a)));t.setTextContent(i)}function SV(t,e=!1){let n=Ov(t),o=(function(r){let i={},s={},a=[],l="(?<![\\\\])";for(let c of r){let{tag:d}=c;i[d]=c;let u=d.replace(/(\*|\^|\+)/g,"\\$1");a.push(u),d.length===1?s[d]=new RegExp(`(?<![\\\\${u}])(${u})((\\\\${u})?.*?[^${u}\\s](\\\\${u})?)((?<!\\\\)|(?<=\\\\\\\\))(${u})(?![\\\\${u}])`):s[d]=new RegExp(`(?<!\\\\)(${u})((\\\\${u})?.*?[^\\s](\\\\${u})?)((?<!\\\\)|(?<=\\\\\\\\))(${u})(?!\\\\)`)}return{fullMatchRegExpByTag:s,openTagsRegExp:new RegExp(`${l}(${a.join("|")})`,"g"),transformersByTag:i}})(n.textFormat);return(r,i)=>{let s=r.split(`
|
|
131
|
-
`),a=s.length,l=i||Qe();l.clear();for(let d=0;d<a;d++){let u=s[d],[p,f]=kV(s,d,n.multilineElement,l);p?d=f:NV(u,l,n.element,o,n.textMatch,e)}let c=l.getChildren();for(let d of c)!e&&Nv(d)&&l.getChildrenSize()>1&&d.remove();$()!==null&&l.selectStart()}}function kV(t,e,n,o){for(let r of n){let{handleImportAfterStartMatch:i,regExpEnd:s,regExpStart:a,replace:l}=r,c=t[e].match(a);if(!c)continue;if(i){let h=i({lines:t,rootNode:o,startLineIndex:e,startMatch:c,transformer:r});if(h===null)continue;if(h)return h}let d=typeof s=="object"&&"regExp"in s?s.regExp:s,u=s&&typeof s=="object"&&"optional"in s?s.optional:!s,p=e,f=t.length;for(;p<f;){let h=d?t[p].match(d):null;if(!h&&(!u||u&&p<f-1)){p++;continue}if(h&&e===p&&h.index===c.index){p++;continue}let m=[];if(h&&e===p)m.push(t[e].slice(c[0].length,-h[0].length));else for(let _=e;_<=p;_++)if(_===e){let b=t[_].slice(c[0].length);m.push(b)}else if(_===p&&h){let b=t[_].slice(0,-h[0].length);m.push(b)}else m.push(t[_]);if(l(o,null,c,h,m,!0)!==!1)return[!0,p];break}}return[!1,e]}function NV(t,e,n,o,r,i){let s=vt(t),a=fe();a.append(s),e.append(a);for(let{regExp:l,replace:c}of n){let d=t.match(l);if(d&&(s.setTextContent(t.slice(d[0].length)),c(a,[s],d,!0)!==!1))break}if(Fs(s,o,r),a.isAttached()&&t.length>0){let l=a.getPreviousSibling();if(!i&&(qt(l)||Br(l)||vn(l))){let c=l;if(vn(l)){let d=l.getLastDescendant();c=d==null?null:le(d,Wc)}c!=null&&c.getTextContentSize()>0&&(c.splice(c.getChildrenSize(),0,[Eo(),...a.getChildren()]),a.remove())}}}function DV(t,...e){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",t);for(let r of e)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function HA(t,e,n){let o=n.length;for(let r=e;r>=o;r--){let i=r-o;if(KA(t,i,n,0,o)&&t[i+o]!==" ")return i}return-1}function KA(t,e,n,o,r){for(let i=0;i<r;i++)if(t[e+i]!==n[o+i])return!1;return!0}function OV(t,e=Xf){let n=Ov(e),o=kv(n.textFormat,(({tag:s})=>s[s.length-1])),r=kv(n.textMatch,(({trigger:s})=>s));for(let s of e){let a=s.type;if(a==="element"||a==="text-match"||a==="multiline-element"){let l=s.dependencies;for(let c of l)t.hasNode(c)||DV(173,c.getType())}}let i=(s,a,l)=>{(function(c,d,u,p){let f=c.getParent();if(!Rt(f)||c.getFirstChild()!==d)return!1;let h=d.getTextContent();if(h[u-1]!==" ")return!1;for(let{regExp:m,replace:_}of p){let b=h.match(m);if(b&&b[0].length===(b[0].endsWith(" ")?u:u-1)){let y=d.getNextSiblings(),[x,v]=d.splitText(u);if(_(c,v?[v,...y]:y,b,!1)!==!1)return x.remove(),!0}}return!1})(s,a,l,n.element)||(function(c,d,u,p){let f=c.getParent();if(!Rt(f)||c.getFirstChild()!==d)return!1;let h=d.getTextContent();if(h[u-1]!==" ")return!1;for(let{regExpStart:m,replace:_,regExpEnd:b}of p){if(b&&!("optional"in b)||b&&"optional"in b&&!b.optional)continue;let y=h.match(m);if(y&&y[0].length===(y[0].endsWith(" ")?u:u-1)){let x=d.getNextSiblings(),[v,E]=d.splitText(u);if(_(c,E?[E,...x]:x,y,null,null,!1)!==!1)return v.remove(),!0}}return!1})(s,a,l,n.multilineElement)||(function(c,d,u){let p=c.getTextContent(),f=u[p[d-1]];if(f==null)return!1;d<p.length&&(p=p.slice(0,d));for(let h of f){if(!h.replace||!h.regExp)continue;let m=p.match(h.regExp);if(m===null)continue;let _=m.index||0,b=_+m[0].length,y;return _===0?[y]=c.splitText(b):[,y]=c.splitText(_,b),y.selectNext(0,0),h.replace(y,m),!0}return!1})(a,l,r)||(function(c,d,u){let p=c.getTextContent(),f=d-1,h=p[f],m=u[h];if(!m)return!1;for(let _ of m){let{tag:b}=_,y=b.length,x=f-y+1;if(y>1&&!KA(p,x,b,0,y)||p[x-1]===" ")continue;let v=p[f+1];if(_.intraword===!1&&v&&!Yf.test(v))continue;let E=c,C=E,k=HA(p,x,b),T=C;for(;k<0&&(T=T.getPreviousSibling())&&!qe(T);)if(Q(T)){if(T.hasFormat("code"))continue;let K=T.getTextContent();C=T,k=HA(K,K.length,b)}if(k<0||C===E&&k+y===x)continue;let w=C.getTextContent();if(k>0&&w[k-1]===h)continue;let S=w[k-1];if(_.intraword===!1&&S&&!Yf.test(S))continue;let N=E.getTextContent(),D=N.slice(0,x)+N.slice(f+1);E.setTextContent(D);let O=C===E?D:w;C.setTextContent(O.slice(0,k)+O.slice(k+y));let M=$(),I=Yo();gt(I);let L=f-y*(C===E?2:1)+1;I.anchor.set(C.__key,k,"text"),I.focus.set(E.__key,L,"text");for(let K of _.format)I.hasFormat(K)||I.formatText(K);I.anchor.set(I.focus.key,I.focus.offset,I.focus.type);for(let K of _.format)I.hasFormat(K)&&I.toggleFormat(K);return F(M)&&(I.format=M.format),!0}})(a,l,o)};return t.registerUpdateListener((({tags:s,dirtyLeaves:a,editorState:l,prevEditorState:c})=>{if(s.has(cD)||s.has(Ga)||t.isComposing())return;let d=l.read($),u=c.read($);if(!F(u)||!F(d)||!d.isCollapsed()||d.is(u))return;let p=d.anchor.key,f=d.anchor.offset,h=l._nodeMap.get(p);!Q(h)||!a.has(p)||f!==1&&f>u.anchor.offset+1||t.update((()=>{if(!Ps(h))return;let m=h.getParent();m===null||Sv(m)||i(m,h,d.anchor.offset)}))}))}var UA=/^(\s*)(\d{1,})\.\s/,jA=/^(\s*)[-*+]\s/,VA=/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,Dv=/^(#{1,6})\s/,WA=/^>\s/,GA=/^[ \t]*```([\w-]+)?/,YA=/[ \t]*```$/,IV=/^[ \t]*```[^`]+(?:(?:`{1,2}|`{4,})[^`]+)*```(?:[^`]|$)/,MV=/^(?:\|)(.+)(?:\|)\s?$/,AV=/^(\| ?:?-*:? ?)+\|\s?$/,qA=t=>(e,n,o,r)=>{let i=t(o);i.append(...n),e.replace(i),r||i.select(0,0)},Iv=t=>(e,n,o,r)=>{let i=e.getPreviousSibling(),s=e.getNextSibling(),a=Vc(t==="check"?o[3]==="x":void 0);if(vn(s)&&s.getListType()===t){let c=s.getFirstChild();c!==null?c.insertBefore(a):s.append(a),e.remove()}else if(vn(i)&&i.getListType()===t)i.append(a),e.remove();else{let c=el(t,t==="number"?Number(o[2]):void 0);c.append(a),e.replace(c)}a.append(...n),r||a.select(0,0);let l=(function(c){let d=c.match(/\t/g),u=c.match(/ /g),p=0;return d&&(p+=d.length),u&&(p+=Math.floor(u.length/4)),p})(o[1]);l&&a.setIndent(l)},Jf=(t,e,n)=>{let o=[],r=t.getChildren(),i=0;for(let s of r)if(Wc(s)){if(s.getChildrenSize()===1){let d=s.getFirstChild();if(vn(d)){o.push(Jf(d,e,n+1));continue}}let a=" ".repeat(4*n),l=t.getListType(),c=l==="number"?`${t.getStart()+i}. `:l==="check"?`- [${s.getChecked()?"x":" "}] `:"- ";o.push(a+c+e(s)),i++}return o.join(`
|
|
132
|
-
`)},JA={dependencies:[Ef],export:(t,e)=>{if(!Fr(t))return null;let n=Number(t.getTag().slice(1));return"#".repeat(n)+" "+e(t)},regExp:Dv,replace:qA((t=>{let e="h"+t[1].length;return Ss(e)})),type:"element"},XA={dependencies:[wf],export:(t,e)=>{if(!Br(t))return null;let n=e(t).split(`
|
|
133
|
-
`),o=[];for(let r of n)o.push("> "+r);return o.join(`
|
|
134
|
-
`)},regExp:WA,replace:(t,e,n,o)=>{if(o){let i=t.getPreviousSibling();if(Br(i))return i.splice(i.getChildrenSize(),0,[Eo(),...e]),void t.remove()}let r=ks();r.append(...e),t.replace(r),o||r.select(0,0)},type:"element"},ZA={dependencies:[CA],export:t=>{if(!Sv(t))return null;let e=t.getTextContent();return"```"+(t.getLanguage()||"")+(e?`
|
|
135
|
-
`+e:"")+"\n```"},regExpEnd:{optional:!0,regExp:YA},regExpStart:GA,replace:(t,e,n,o,r,i)=>{let s,a;if(!e&&r){if(r.length===1)o?(s=od(),a=n[1]+r[0]):(s=od(n[1]),a=r[0].startsWith(" ")?r[0].slice(1):r[0]);else{if(s=od(n[1]),r[0].trim().length===0)for(;r.length>0&&!r[0].length;)r.shift();else r[0]=r[0].startsWith(" ")?r[0].slice(1):r[0];for(;r.length>0&&!r[r.length-1].length;)r.pop();a=r.join(`
|
|
136
|
-
`)}let l=vt(a);s.append(l),t.append(s)}else e&&qA((l=>od(l?l[1]:void 0)))(t,e,n,i)},type:"multiline-element"},QA={dependencies:[tr,Ni],export:(t,e)=>vn(t)?Jf(t,e,0):null,regExp:jA,replace:Iv("bullet"),type:"element"},LV={dependencies:[tr,Ni],export:(t,e)=>vn(t)?Jf(t,e,0):null,regExp:VA,replace:Iv("check"),type:"element"},eL={dependencies:[tr,Ni],export:(t,e)=>vn(t)?Jf(t,e,0):null,regExp:UA,replace:Iv("number"),type:"element"},tL={format:["code"],tag:"`",type:"text-format"},nL={format:["highlight"],tag:"==",type:"text-format"},oL={format:["bold","italic"],tag:"***",type:"text-format"},rL={format:["bold","italic"],intraword:!1,tag:"___",type:"text-format"},iL={format:["bold"],tag:"**",type:"text-format"},sL={format:["bold"],intraword:!1,tag:"__",type:"text-format"},aL={format:["strikethrough"],tag:"~~",type:"text-format"},lL={format:["italic"],tag:"*",type:"text-format"},cL={format:["italic"],intraword:!1,tag:"_",type:"text-format"},dL={dependencies:[Za],export:(t,e,n)=>{if(!Je(t)||Uc(t))return null;let o=t.getTitle(),r=e(t);return o?`[${r}](${t.getURL()} "${o}")`:`[${r}](${t.getURL()})`},importRegExp:/(?:\[([^[]+)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))/,regExp:/(?:\[([^[]+)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))$/,replace:(t,e)=>{let[,n,o,r]=e,i=cf(o,{title:r}),s=vt(n);return s.setFormat(t.getFormat()),i.append(s),t.replace(i),s},trigger:")",type:"text-match"},uL=[JA,XA,QA,eL],pL=[ZA],fL=[tL,oL,rL,iL,sL,nL,lL,cL,aL],hL=[dL],Xf=[...uL,...pL,...fL,...hL];function RV(t,e=Xf,n,o=!1,r=!1){let i=o?t:(function(s,a=!1){let l=s.split(`
|
|
137
|
-
`),c=!1,d=[];for(let u=0;u<l.length;u++){let p=l[u],f=d[d.length-1];IV.test(p)?d.push(p):GA.test(p)||YA.test(p)?(c=!c,d.push(p)):c||p===""||f===""||!f||Dv.test(f)||Dv.test(p)||WA.test(p)||UA.test(p)||jA.test(p)||VA.test(p)||MV.test(p)||AV.test(p)||!a?d.push(p):d[d.length-1]=f+p}return d.join(`
|
|
138
|
-
`)})(t,r);return SV(e,o)(i,n)}function PV(t=Xf,e,n=!1){return(function(r,i=!1){let s=Ov(r),a=[...s.multilineElement,...s.element],l=!i,c=s.textFormat.filter((d=>d.format.length===1)).sort(((d,u)=>Number(d.format.includes("code"))-Number(u.format.includes("code"))));return d=>{let u=[],p=(d||Qe()).getChildren();for(let f=0;f<p.length;f++){let h=p[f],m=wV(h,a,c,s.textMatch);m!=null&&u.push(l&&f>0&&!Nv(h)&&!Nv(p[f-1])?`
|
|
139
|
-
`.concat(m):m)}return u.join(`
|
|
140
|
-
`)}})(t,n)(e)}var it=Mv,Ole=it.$convertFromMarkdownString,Ile=it.$convertToMarkdownString,Mle=it.BOLD_ITALIC_STAR,Ale=it.BOLD_ITALIC_UNDERSCORE,Lle=it.BOLD_STAR,Rle=it.BOLD_UNDERSCORE,Ple=it.CHECK_LIST,Fle=it.CODE,Ble=it.ELEMENT_TRANSFORMERS,gL=it.HEADING,$le=it.HIGHLIGHT,mL=it.INLINE_CODE,zle=it.ITALIC_STAR,Hle=it.ITALIC_UNDERSCORE,Kle=it.LINK,Ule=it.MULTILINE_ELEMENT_TRANSFORMERS,_L=it.ORDERED_LIST,bL=it.QUOTE,jle=it.STRIKETHROUGH,Vle=it.TEXT_FORMAT_TRANSFORMERS,Wle=it.TEXT_MATCH_TRANSFORMERS,yL=it.TRANSFORMERS,xL=it.UNORDERED_LIST,vL=it.registerMarkdownShortcuts;var Av={};Re(Av,{DEFAULT_TRANSFORMERS:()=>CL,MarkdownShortcutPlugin:()=>FV});pt();var CL=[{dependencies:[yf],export:t=>uI(t)?"***":null,regExp:/^(---|\*\*\*|___)\s?$/,replace:(t,e,n,o)=>{let r=tl();o||t.getNextSibling()!=null?t.replace(r):t.insertBefore(r),r.selectNext()},type:"element"},...yL];function FV({transformers:t=CL}){let[e]=be();return P((()=>vL(e,t)),[e,t]),null}var EL=Av,Zle=EL.DEFAULT_TRANSFORMERS,wL=EL.MarkdownShortcutPlugin;function TL(){return g(wL,{transformers:[gL,xL,_L,bL,mL]})}var Lv={};Re(Lv,{OnChangePlugin:()=>$V});pt();var BV=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?un:P;function $V({ignoreHistoryMergeTagChange:t=!0,ignoreSelectionChange:e=!1,onChange:n}){let[o]=be();return BV((()=>{if(n)return o.registerUpdateListener((({editorState:r,dirtyElements:i,dirtyLeaves:s,prevEditorState:a,tags:l})=>{e&&i.size===0&&s.size===0||t&&l.has(Ya)||a.isEmpty()||n(r,o,l)}))}),[o,t,e,n]),null}var zV=Lv,SL=zV.OnChangePlugin;ke();function HV(){return{text:"",components:{}}}var KV=[{tag:"code",format:"code"},{tag:"s",format:"strikethrough"},{tag:"u",format:"underline"},{tag:"i",format:"italic"},{tag:"b",format:"bold"},{tag:"sup",format:"superscript"},{tag:"sub",format:"subscript"}];function NL(t){let e=[];return KV.forEach(({tag:n,format:o})=>{t.hasFormat(o)&&e.push(n)}),e}function Rv(t,e){t.text+=e.text,Object.assign(t.components,e.components)}function UV(t,e,n){for(let o=t.length-1;o>=0;o-=1){let r=t[o];e.includes(r)||(n.text+=`</${r}>`,t.splice(o,1))}e.forEach(o=>{t.includes(o)||(n.text+=`<${o}>`,t.push(o))})}function kL(t,e){for(let n=t.length-1;n>=0;n-=1)e.text+=`</${t[n]}>`;t.length=0}function DL(t,e){let n=t.getChildren();for(let o of n)if(Q(o)){let r=NL(o);if(r.length!==e.length)return!1;for(let i=0;i<r.length;i+=1)if(r[i]!==e[i])return!1}else{if(qe(o)||hl(o))continue;if(o instanceof Pt){if(!DL(o,e))return!1}else return!1}return!0}function jV(t){let e=t.getComponentId(),n=t.getComponentName(),o=Ze(t.getComponentData()),r={[e]:{type:n,data:o}};return{text:`{${n}:${e}}`,components:r}}function VV(t){let e=Je(t)&&t.getURL()||"",n=Je(t)&&t.getTarget()||"",o=jr(t),r=XV(n)?` target="${n}"`:"";return{text:`<a href="${e}"${r}>${o.text}</a>`,components:o.components}}function jr(t){let e=HV(),n=[];return t.getChildren().forEach(r=>{if(qe(r)){e.text+="<br>";return}if(hl(r)){Rv(e,jV(r));return}if(Q(r)){let i=NL(r);UV(n,i,e);let s=r.getTextContent();s&&(e.text+=qV(s));return}if(Je(r)){n.length>0&&!DL(r,n)&&kL(n,e),Rv(e,VV(r));return}if(r instanceof Pt){Rv(e,jr(r));return}console.log("unhandled node"),console.log(r)}),n.length>0&&kL(n,e),e}function Pv(t){let e=[];return t.getChildren().forEach(n=>{Wc(n)&&e.push(WV(n))}),JV(e)}function WV(t){let e=t.getFirstChild();if(e&&vn(e))return{itemsType:e.getTag()==="ol"?"orderedList":"unorderedList",items:Pv(e)};let n=jr(t),o={content:n.text};return Pi(n.components)&&(o.components=n.components),o}function GV(t){let e=[];return t.getChildren().forEach(n=>{if(po(n)){let o=[];n.getChildren().forEach(r=>{if(Do(r)){let s=r.getHeaderStyles()>0,a=r.getChildren(),l=[];a.forEach(c=>{if(Hr(c))l.push({type:c.getBlockName(),data:Ze(c.getBlockData())});else if(qt(c)){let d=jr(c),u={type:"paragraph",data:{text:d.text}};Pi(d.components)&&(u.data.components=d.components),l.push(u)}else if(Fr(c)){let d=c.getTag().slice(1),u=jr(c),p={type:"heading",data:{text:u.text,level:parseInt(d)}};Pi(u.components)&&(p.data.components=u.components),l.push(p)}else if(Br(c)){let d=jr(c),u={type:"quote",data:{text:d.text}};Pi(d.components)&&(u.data.components=d.components),l.push(u)}else if(vn(c)){let d=c.getTag(),u={type:d==="ol"?"orderedList":"unorderedList",data:{style:d==="ol"?"ordered":"unordered",items:Pv(c)}};l.push(u)}}),o.push({blocks:l,type:s?"header":"data"})}}),e.push({cells:o})}}),{rows:e}}function OL(){let t=[];for(Qe().getChildren().forEach(o=>{if(qt(o)){let r=jr(o),i={type:"paragraph",data:{text:r.text}};Pi(r.components)&&(i.data.components=r.components),t.push(i)}else if(Fr(o)){let r=o.getTag().slice(1),i=jr(o),s={type:"heading",data:{text:i.text,level:parseInt(r)}};Pi(i.components)&&(s.data.components=i.components),t.push(s)}else if(Br(o)){let r=jr(o),i={type:"quote",data:{text:r.text}};Pi(r.components)&&(i.data.components=r.components),t.push(i)}else if(vn(o)){let r=o.getTag(),i={type:r==="ol"?"orderedList":"unorderedList",data:{style:r==="ol"?"ordered":"unordered",items:Pv(o)}};t.push(i)}else if(_M(o)){let i={type:"table",data:GV(o)};t.push(i)}else if(Hr(o)){let r={type:o.getBlockName(),data:Ze(o.getBlockData())};t.push(r)}else if(Mn(o)&&o.getType()==="horizontalrule"){let r={type:"delimiter",data:{}};t.push(r)}});YV(t);)t.pop();return t.length===0?null:{time:Date.now(),blocks:t,version:"lexical-0.31.2"}}function YV(t){let e=t.length>0&&t.at(-1);return!!(e&&e.type==="paragraph"&&!e.data?.text&&!Pi(e.data?.components||{}))}function Pi(t){return t?Object.keys(t).length>0:!1}function qV(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function JV(t){let e=[];return t.forEach(n=>{n.itemsType&&n.items&&e.length>0?(e.at(-1).itemsType=n.itemsType,e.at(-1).items=n.items):e.push(n)}),e}function XV(t){return["_blank","_self","_parent","_top"].includes(t)}function IL(t){let e=Qe();e.clear();let n=t?.blocks||[];for(let o of n)if(o.type==="paragraph"){let r=fe();if(o.data.text){let i=Bs(o.data.text,o.data.components);r.append(...i)}e.append(r)}else if(o.type==="heading"){let r=`h${o.data?.level||2}`,i=Ss(r);if(o.data.text){let s=Bs(o.data.text,o.data.components);i.append(...s)}e.append(i)}else if(o.type==="quote"){let r=ks();if(o.data?.text){let i=Bs(o.data.text,o.data.components);r.append(...i)}e.append(r)}else if(o.type==="orderedList"||o.type==="unorderedList"){let r=o.data.style==="ordered"?"number":"bullet",i=el(r);for(let s of o.data.items)i.append(...Fv(s,r));e.append(i)}else if(o.type==="table"){let r=pM();(o.data?.rows||[]).forEach(s=>{let a=fM();(s.cells||[]).forEach(c=>{let d=c.blocks||[],p=(c.type||"data")==="header"?1:0,f=uM(p);d.forEach(h=>{if(h.type==="paragraph"){let m=fe();if(h.data?.text){let _=Bs(h.data.text,h.data.components);m.append(..._)}f.append(m)}else if(h.type==="heading"){let m=`h${h.data?.level||2}`,_=Ss(m);if(h.data?.text){let b=Bs(h.data.text,h.data.components);_.append(...b)}f.append(_)}else if(h.type==="quote"){let m=ks();if(h.data?.text){let _=Bs(h.data.text,h.data.components);m.append(..._)}f.append(m)}else if(h.type==="orderedList"||h.type==="unorderedList"){let m=h.data.style==="ordered"?"number":"bullet",_=el(m);for(let b of h.data.items)_.append(...Fv(b,m));f.append(_)}else{let m=Is(h.type,h.data||{});f.append(m)}}),a.append(f)}),r.append(a)}),e.append(r)}else if(o.type==="delimiter"){let r=tl();e.append(r)}else if(o.type){let r=Is(o.type,o.data||{});e.append(r)}}function Bs(t,e){let n=document.createElement("template");n.innerHTML=t;let o=n.content,r=[];function i(s){if(s.nodeType===Node.TEXT_NODE)return ZV(s.textContent||"",e);if(s.nodeType===Node.ELEMENT_NODE){let a=s,l=Array.from(a.childNodes).map(i).filter(c=>!!c).flat();switch(a.tagName.toLowerCase()){case"b":case"strong":return l.map(c=>(c instanceof Ft&&c.toggleFormat("bold"),c));case"i":case"em":return l.map(c=>(c instanceof Ft&&c.toggleFormat("italic"),c));case"u":return l.map(c=>(c instanceof Ft&&c.toggleFormat("underline"),c));case"s":return l.map(c=>(c instanceof Ft&&c.toggleFormat("strikethrough"),c));case"sup":return l.map(c=>(c instanceof Ft&&c.toggleFormat("superscript"),c));case"sub":return l.map(c=>(c instanceof Ft&&c.toggleFormat("subscript"),c));case"code":return l.map(c=>(c instanceof Ft&&c.toggleFormat("code"),c));case"br":return[];case"a":{let c=cf(a.getAttribute("href")||""),d=a.getAttribute("target");return d&&c.setTarget(d),c.append(...l),[Tt(c)]}default:return console.log("unhandled tag: "+a.tagName),console.log(l),l}}return null}return o.childNodes.forEach(s=>{let a=i(s);Array.isArray(a)?r.push(...a):a&&r.push(a)}),r}function ZV(t,e){let n=[];if(!t)return n;let o=/\{([^:{}]+):([^}]+)\}/g,r=0,i;for(;(i=o.exec(t))!==null;){let a=t.slice(r,i.index);a&&n.push(vt(a));let l=i[1],c=i[2],d=e?.[c];d?n.push(zf(l||d.type,c,d.data?Ze(d.data):{})):n.push(vt(i[0])),r=o.lastIndex}let s=t.slice(r);return s&&n.push(vt(s)),n}function Fv(t,e){let n=[];if(t.content){let o=QV(t);n.push(o)}if(t.items&&t.items.length>0){let o=eW(t,e);n.push(o)}return n}function QV(t){let e=Vc();if(t.content){let n=Bs(t.content,t.components);e.append(...n)}return e}function eW(t,e){let n=Vc();if(t.items&&t.items.length>0){let o=e;t.itemsType==="orderedList"?o="number":t.itemsType==="unorderedList"&&(o="bullet");let r=el(o);for(let i of t.items)r.append(...Fv(i,o));n.append(r)}return n}function ML(t){let[e]=be(),n=Y(0),o=Y(!1);return P(()=>{let i=t.value?.time||0;i>n.current&&(n.current=i,e.update(()=>{o.current=!0,IL(t.value)}))},[e,t.value]),g(SL,{onChange:i=>{if(o.current){o.current=!1;return}i.read(()=>{let s=OL();n.current=s?.time||0,t.onChange&&t.onChange(s)})},ignoreSelectionChange:!0})}ke();function tW(t){let e=!1;return t.querySelectorAll("a [style]").forEach(n=>{if(!(n instanceof HTMLElement))return;let o=n.style;(o.textDecoration?.includes("underline")||o.getPropertyValue("text-decoration")?.includes("underline"))&&(o.removeProperty("text-decoration"),o.removeProperty("text-decoration-skip-ink"),o.removeProperty("-webkit-text-decoration-skip"),e=!0)}),e}function nW(t){let e=!1;return t.querySelectorAll("[style]").forEach(n=>{n instanceof HTMLElement&&n.style.textAlign&&(n.style.removeProperty("text-align"),e=!0)}),e}function AL(){let[t]=be();return P(()=>t.registerCommand(wi,e=>{let{clipboardData:n}=e;if(!n)return!1;let o=n.getData("text/html");if(!o)return!1;let i=new DOMParser().parseFromString(o,"text/html"),s=!1;if(s=tW(i)||s,s=nW(i)||s,!s)return!1;e.preventDefault();let a=vf(t,i),l=$();return F(l)?l.insertNodes(a):To(a),!0},Up),[t]),null}ke();function LL(t){let{editor:e,setIsLinkEditMode:n}=t,{toolbarState:o}=Bf();return P(()=>{let r=i=>{if(Pn(i,{}))return!1;if(EA(i))Rs(e);else if(wA(i)){let{code:s}=i,a=`h${s[s.length-1]}`;Ri(e,o.blockType,a)}else if(SA(i))Vf(e,o.blockType);else if(TA(i))Wf(e,o.blockType);else if(kA(i))e.dispatchCommand(ot,"strikethrough");else if(NA(i))e.dispatchCommand(Ln,void 0);else if(DA(i))e.dispatchCommand(uo,void 0);else if(OA(i))e.dispatchCommand(ot,"subscript");else if(IA(i))e.dispatchCommand(ot,"superscript");else if(MA(i))ml(e);else if(AA(i)){let s=o.isLink?null:"";n(!o.isLink),e.dispatchCommand(Bn,s)}else return!1;return i.preventDefault(),!0};return e.registerCommand(gD,r,Up)},[e,o.isLink,o.blockType,n]),null}ke();var oW=/[\u00A0\u2011]/;function RL(){let[t]=be();return P(()=>{if(!t.hasNodes([Mi]))throw new Error("SpecialCharacterPlugin: SpecialCharacterNode not registered on editor");return t.registerNodeTransform(Ft,e=>{if(eA(e))return;let n=e.getTextContent(),o=oW.exec(n);if(o){let r=o.index,i=o[0],s;r===0?[s]=e.splitText(r+1):[,s]=e.splitText(r,r+1);let a=hv(i);s.replace(a)}})},[t]),null}Hs();ke();function PL(t){let{editor:e}=t,n=Y(null),o=Y(null),[r,i]=R(null),[s,a]=R(!1),[l,c]=R(!1),[d,u]=R(!1),p=we(()=>{if(!r){c(!1),u(!1);return}e.getEditorState().read(()=>{try{let w=td(r).getChildren(),S=-1;for(let D=0;D<w.length;D++){let O=w[D];if(!po(O))continue;if(O.getChildren().some(I=>I.getKey()===r.getKey())){S=D;break}}if(S!==-1){let D=w[S];if(po(D)){let M=D.getChildren()[0];if(Do(M)){let I=M.getHeaderStyles();c((I&Cn.ROW)===Cn.ROW)}}}let N=-1;for(let D=0;D<w.length;D++){let O=w[D];if(!po(O))continue;let M=O.getChildren();for(let I=0;I<M.length;I++)if(M[I].getKey()===r.getKey()){N=I;break}if(N!==-1)break}if(N!==-1){let D=w[0];if(po(D)){let M=D.getChildren()[N];if(Do(M)){let I=M.getHeaderStyles();u((I&Cn.COLUMN)===Cn.COLUMN)}}}}catch{c(!1),u(!1)}})},[e,r]);P(()=>{r&&s&&p()},[r,s,p]),P(()=>{if(!(!r||!s))return e.registerUpdateListener(()=>{p()})},[e,r,s,p]);let f=we(()=>{let T=o.current,w=n.current;if(!w||!r)return;let S=e.getElementByKey(r.getKey());if(!S)return;let N=S.getBoundingClientRect(),D=window.innerWidth,O=window.innerHeight;if(w.style.left=`${N.right-25}px`,w.style.top=`${N.top+5}px`,w.style.display="flex",T)if(s){let L=N.right-185,K=N.top+30;L<10&&(L=N.left),L+185>D-10&&(L=D-185-10),K+280>O-10&&(K=N.top-280-5,K<10&&(K=10)),T.style.left=`${L}px`,T.style.top=`${K}px`,T.style.display="block"}else T.style.display="none"},[e,r,s]);P(()=>{if(!r){n.current&&(n.current.style.display="none"),o.current&&(o.current.style.display="none"),a(!1);return}f();let T=()=>{f()},w=N=>{N.key==="Escape"&&s&&(a(!1),N.preventDefault(),N.stopPropagation())},S=N=>{o.current&&n.current&&!o.current.contains(N.target)&&!n.current.contains(N.target)&&a(!1)};return window.addEventListener("scroll",T,!0),document.addEventListener("keydown",w),document.addEventListener("mousedown",S),()=>{window.removeEventListener("scroll",T,!0),document.removeEventListener("keydown",w),document.removeEventListener("mousedown",S)}},[r,f,s]),P(()=>e.registerCommand(cn,()=>{let T=$();if(F(T)){let w=T.anchor.getNode(),S=ov(w);Do(S)?(r&&S.getKey()!==r.getKey()&&a(!1),i(S)):i(null)}else if(bM(T)){let w=T.getNodes();if(w.length>0){let S=ov(w[0]);Do(S)&&(r&&S.getKey()!==r.getKey()&&a(!1),i(S))}}else i(null);return!1},xi),[e,r]);let h=we(()=>{e.update(()=>{r&&iv(!1)}),a(!1)},[e,r]),m=we(()=>{e.update(()=>{r&&iv(!0)}),a(!1)},[e,r]),_=we(()=>{e.update(()=>{r&&rv(!1)}),a(!1)},[e,r]),b=we(()=>{e.update(()=>{r&&rv(!0)}),a(!1)},[e,r]),y=we(()=>{e.update(()=>{r&&hM()}),a(!1)},[e,r]),x=we(()=>{e.update(()=>{r&&gM()}),a(!1)},[e,r]),v=we(()=>{e.update(()=>{if(!r)return;td(r).remove()}),a(!1)},[e,r]),E=we(()=>{e.update(()=>{if(!r)return;let w=td(r).getChildren(),S=-1;for(let L=0;L<w.length;L++){let K=w[L];if(!po(K))continue;if(K.getChildren().some(q=>q.getKey()===r.getKey())){S=L;break}}if(S===-1)return;let N=w[S];if(!po(N))return;let D=N.getChildren(),O=D[0],I=((Do(O)?O.getHeaderStyles():0)&Cn.ROW)===Cn.ROW;D.forEach(L=>{if(Do(L)){let K=L.getHeaderStyles(),W=I?K^Cn.ROW:K|Cn.ROW;L.setHeaderStyles(W,Cn.ROW)}})}),a(!1)},[e,r]),C=we(()=>{e.update(()=>{if(!r)return;let w=td(r).getChildren(),S=-1;for(let L=0;L<w.length;L++){let K=w[L];if(!po(K))continue;let W=K.getChildren();for(let q=0;q<W.length;q++)if(W[q].getKey()===r.getKey()){S=q;break}if(S!==-1)break}if(S===-1)return;let N=w[0];if(!po(N))return;let O=N.getChildren()[S],I=((Do(O)?O.getHeaderStyles():0)&Cn.COLUMN)===Cn.COLUMN;w.forEach(L=>{if(!po(L))return;let W=L.getChildren()[S];if(Do(W)){let q=W.getHeaderStyles(),B=I?q^Cn.COLUMN:q|Cn.COLUMN;W.setHeaderStyles(B,Cn.COLUMN)}})}),a(!1)},[e,r]);if(!r)return null;let k=e.getRootElement();return k?Yr(g(Me,{children:[g("button",{ref:n,className:"LexicalEditor__tableActionMenuButton",onClick:()=>a(!s),type:"button",children:"\u22EE"}),s&&g("div",{ref:o,className:"LexicalEditor__tableActionMenu",children:[g("button",{className:"LexicalEditor__tableActionMenuItem",onClick:h,children:"Insert row above"}),g("button",{className:"LexicalEditor__tableActionMenuItem",onClick:m,children:"Insert row below"}),g("div",{className:"LexicalEditor__tableActionMenuDivider"}),g("button",{className:"LexicalEditor__tableActionMenuItem",onClick:_,children:"Insert column left"}),g("button",{className:"LexicalEditor__tableActionMenuItem",onClick:b,children:"Insert column right"}),g("div",{className:"LexicalEditor__tableActionMenuDivider"}),g("button",{className:"LexicalEditor__tableActionMenuItem",onClick:y,children:"Delete column"}),g("button",{className:"LexicalEditor__tableActionMenuItem",onClick:x,children:"Delete row"}),g("button",{className:"LexicalEditor__tableActionMenuItem",onClick:v,children:"Delete table"}),g("div",{className:"LexicalEditor__tableActionMenuDivider"}),g("button",{className:"LexicalEditor__tableActionMenuItem",onClick:E,children:l?"Remove row header":"Convert to row header"}),g("button",{className:"LexicalEditor__tableActionMenuItem",onClick:C,children:d?"Remove column header":"Convert to column header"})]})]}),k.parentElement||document.body):null}ke();function FL(){let[t]=be();return P(()=>t.registerNodeTransform(xD,e=>{let n=e.getLastChild();qt(n)||e.append(fe())}),[t]),null}var rW={namespace:"RootCMS",theme:GM,nodes:[xO,Ef,wf,Za,tr,Ni,yf,Rf,Lf,xM,pl,fl,Mi],onError:t=>{throw console.error("[LexicalEditor] error:",t),t}};function $L(t){return g(GO,{initialConfig:rW,children:g(UM,{children:g(WM,{children:g("div",{className:Se(t.className,"LexicalEditor",t.variant==="comment"&&"LexicalEditor--comment",!t.autosize&&"LexicalEditor--withMaxHeight"),children:g(lW,{deepKey:t.deepKey,placeholder:t.placeholder,value:t.value,onChange:t.onChange,onFocus:t.onFocus,onBlur:t.onBlur,variant:t.variant,autoFocus:t.autoFocus,blockComponents:t.blockComponents,inlineComponents:t.inlineComponents})})})})})}var iW=lv({name:"image",label:"Image Embed",preview:{title:"{file.alt}",image:"{file.src}"},fields:[SM({id:"file",label:"Image"}),av({id:"caption",label:"Caption",variant:"textarea",translate:!0,deprecated:!0})]}),sW=lv({name:"html",label:"HTML Code",preview:{title:"{html}"},fields:[av({id:"html",label:"HTML",help:"HTML code to embed. Please use caution when inserting HTML.",variant:"textarea",autosize:!0,maxRows:50})]}),aW=[iW,sW];function lW(t){let{historyState:e}=jM(),[n]=be(),[o,r]=R(n),[i,s]=R(!1),[a,l]=R(null),c=J(()=>{let D=new Map;return t.variant!=="comment"&&aW.forEach(O=>{D.set(O.name,O)}),t.blockComponents?.forEach(O=>{D.set(O.name,O)}),D},[t.blockComponents]),d=Array.from(c.values()),[u,p]=R(null),f=J(()=>{let D=new Map;return t.inlineComponents?.forEach(O=>{D.set(O.name,O)}),D},[t.inlineComponents]),h=Array.from(f.values()),[m,_]=R(null),b=D=>{D&&l(D)},y=(D,O)=>{let M=c.get(D);if(!M)return;let I=O?.initialValue?Ze(O.initialValue):Xs(M);p({schema:M,mode:O?.mode??"create",initialValue:I,nodeKey:O?.nodeKey})},x=(D,O)=>{n.update(()=>{let M=Is(D,O);To([M]),M.selectNext()})},v=(D,O)=>{n.update(()=>{let M=St(D);Hr(M)&&M.setBlockData(O)})},E=()=>{p(null)};P(()=>{if(!t.deepKey)return;let D=O=>{let M=O.detail;if(!M||M.richTextDeepKey!==t.deepKey)return;let I=c.get(M.blockName);if(!I)return;let L=null,K=null;n.getEditorState().read(()=>{let W=Qe(),q=-1;for(let B of W.getChildren())if(Hr(B)){q+=1;let se=B.getBlockName();if(q===M.blockIndex&&se===M.blockName){L=B.getKey(),K=B.getBlockData();break}}if(!L){for(let B of W.getChildren())if(Hr(B)&&B.getBlockName()===M.blockName){L=B.getKey(),K=B.getBlockData();break}}}),L&&p({schema:I,mode:"edit",initialValue:K?Ze(K):{},nodeKey:L})};return window.addEventListener(uv,D),()=>window.removeEventListener(uv,D)},[n,t.deepKey,c]),P(()=>{if(!t.deepKey)return;let D=O=>{let M=O.detail;if(!M||M.richTextDeepKey!==t.deepKey)return;let I=f.get(M.componentName);if(!I)return;let L=null,K=null,W=null;n.getEditorState().read(()=>{for(let{node:q}of uO())if(hl(q)&&q.getComponentId()===M.componentId){L=q.getKey(),K=q.getComponentData(),W=q.getComponentName();break}}),L&&_({schema:I,componentName:W||M.componentName,componentId:M.componentId,mode:"edit",initialValue:K?Ze(K):{},nodeKey:L})};return window.addEventListener(pv,D),()=>window.removeEventListener(pv,D)},[n,t.deepKey,f]);let C=D=>{u&&(u.mode==="edit"&&u.nodeKey?v(u.nodeKey,D):x(u.schema.name,D),E())},k=(D,O)=>{let M=f.get(D);if(!M)return;let I=O?.initialValue?Ze(O.initialValue):Xs(M);_({schema:M,componentName:D,componentId:O?.componentId||pr(),mode:O?.mode??"create",initialValue:I,nodeKey:O?.nodeKey})},T=(D,O,M)=>{n.update(()=>{let I=zf(D,O,M);To([I]),I.selectNext()})},w=(D,O,M,I)=>{n.update(()=>{let L=St(D);hl(L)&&(L.setComponentName(O),L.setComponentId(M),L.setComponentData(I))})},S=()=>{_(null)},N=D=>{if(!m)return;let{componentName:O,mode:M,nodeKey:I}=m;M==="edit"&&I?w(I,O,D.componentId,D.data):T(O,D.componentId,D.data),S()};return g(zM,{components:f,onEditComponent:(D,O)=>k(D,{mode:O?.mode??"edit",initialValue:O?.initialValue,componentId:O?.componentId,nodeKey:O?.nodeKey}),children:g(FM,{blocks:c,onEditBlock:y,children:[g(ML,{value:t.value,onChange:t.onChange}),g(PA,{editor:n,activeEditor:o,setActiveEditor:r,setIsLinkEditMode:s,variant:t.variant,blockComponents:d,inlineComponents:h,onInsertBlockComponent:D=>y(D,{mode:"create"}),onInsertInlineComponent:D=>k(D,{mode:"create"})}),g(LL,{editor:o,setIsLinkEditMode:s}),g(lI,{externalHistoryState:e}),g(BI,{contentEditable:g("div",{className:"LexicalEditor__scroller",children:g("div",{className:"LexicalEditor__root",ref:b,children:g(eI,{className:"LexicalEditor__editor",placeholder:g(dW,{placeholder:t.placeholder})})})}),ErrorBoundary:nI}),g(fI,{}),g(hI,{}),t.variant!=="comment"&&g(Me,{children:[g(pI,{}),g(TM,{}),g(PL,{editor:o}),g(HI,{maxIndent:7})]}),g(TL,{}),t.autoFocus&&g(VO,{}),g(FL,{}),g(RL,{}),g(AL,{}),t.variant!=="comment"&&g(BA,{}),a&&g(Me,{children:[g(FA,{anchorElem:a,setIsLinkEditMode:s}),g(oA,{anchorElem:a,isLinkEditMode:i,setIsLinkEditMode:s})]}),u&&g(qM,{schema:u.schema,opened:!0,initialValue:u.initialValue,mode:u.mode,onClose:E,onSubmit:C}),m&&g(QM,{schema:m.schema,opened:!0,componentId:m.componentId,initialValue:m.initialValue,mode:m.mode,onClose:S,onSubmit:N})]})})}var BL=["Once upon a placeholder...","Start writing something legendary...","Words go here. Preferably brilliant ones...","Compose like nobody\u2019s watching...","Add text that makes Hemingway jealous...","Here lies your unwritten brilliance...","This is where the magic happens...","Let the words flow...","In the beginning, there was a blank page...","To write, or not to write, that is the question..."];function cW(){let t=Math.floor(Math.random()*BL.length);return BL[t]}function dW(t){let e=J(()=>t.placeholder||cW(),[]);return g("div",{className:"LexicalEditor__placeholder",children:e})}function zL(t){if(IE().preferences.EnableEditorJSEditor){let{deepKey:n,...o}=t;return g(yk,{...o})}return g($L,{...t})}function HL(t){let e=t.field,[n,o]=R(null),r=Hn().controller,i=s=>{o(a=>(a?.time!==s?.time&&r.updateKey(t.deepKey,s),s))};return Fo(t.deepKey,s=>{o(s)}),g(zL,{deepKey:t.deepKey,value:n,placeholder:e.placeholder,blockComponents:e.blockComponents,inlineComponents:e.inlineComponents,onChange:i,onFocus:t.onFocus,onBlur:t.onBlur,autosize:e.autosize})}ke();function KL(t){let e=t.field,[n,o]=en(t.deepKey,""),r=J(()=>(e.options||[]).map(i=>typeof i=="string"?{label:i,value:i}:{label:i.label??i.value??"",value:i.value??i.label??""}),[e.options]);return g("div",{className:"DocEditor__SelectField",children:g(Ro,{data:r,placeholder:e.placeholder,value:n,onChange:i=>o(i||""),size:"xs",radius:0,searchable:e.searchable??!0,clearable:!0,dropdownComponent:"div"})})}ke();function UL(t){let{value:e,variant:n,scrollRef:o}=t,r=e.split(/([\u00A0\u2011])/g);return g("div",{ref:o,className:`StringField__highlighter StringField__highlighter--${n}`,"aria-hidden":"true",children:[r.map((i,s)=>i==="\xA0"||i==="\u2011"?g("span",{className:"StringField__highlight",children:i},s):g("span",{children:i},s)),n==="textarea"&&e.endsWith(`
|
|
141
|
-
`)&&g("br",{})]})}function jL(t){let e=t.field,[n,o]=en(t.deepKey,""),r=Y(null),i=Y(null),[s,a]=R(null),l=h=>{o(h.currentTarget.value)},c=h=>{t.onFocus?.(h),Vn(t.deepKey,{scroll:!0})},d=h=>{t.onBlur?.(h),Vn(null)},u=h=>{let m=h.target.value;if(m.trim()){let _=m;try{let b=m.replace(/'([^'\\]*(?:\\.[^'\\]*)*)'/g,'"$1"').replace(/,\s*([\]}])/g,"$1");JSON.parse(b),_=b}catch{}try{let b=JSON.parse(_),y=JSON.stringify(b,null,2);o(y),a(null)}catch(b){a(b.message)}}else a(null);t.onBlur?.(h),Vn(null)},p=h=>{r.current&&(r.current.scrollTop=h.target.scrollTop,r.current.scrollLeft=h.target.scrollLeft)},f=h=>{i.current&&(i.current.scrollLeft=h.target.scrollLeft)};return e.variant==="json"?g("div",{className:"StringField__container",children:[g(Lo,{className:Se("StringField__input","StringField__input--json",s&&"StringField__input--error"),size:"xs",radius:0,autosize:e.autosize,minRows:4,maxRows:e.maxRows||20,value:n,onChange:l,onFocus:c,onBlur:u,onScroll:p}),s&&g("div",{className:"StringField__jsonError",children:["Invalid JSON: ",s]})]}):e.variant==="textarea"?g("div",{className:"StringField__container",children:[g(UL,{value:n||"",variant:"textarea",scrollRef:r}),g(Lo,{className:"StringField__input",size:"xs",radius:0,autosize:e.autosize,minRows:4,maxRows:e.maxRows||12,value:n,onChange:l,onFocus:c,onBlur:d,onScroll:p})]}):g("div",{className:"StringField__container",children:[g(UL,{value:n||"",variant:"input",scrollRef:i}),g(lr,{className:"StringField__input",size:"xs",radius:0,value:n,onChange:l,onFocus:c,onBlur:d,onScroll:f})]})}var WL=Ot({});function Zf(){return It(WL)}function Ne(t){let e=t.docId.split("/")[0],n=hE(e),o=Hn(),r=n.loading||o.loading,i=n.schema?.fields||[];return g(WL.Provider,{value:n?.schema?.types||{},children:g(qw,{children:g("div",{className:Se(t.className,"DocEditor"),children:[g(Wv,{visible:r,loaderProps:{color:"gray",size:"xl"}}),!r&&!t.hideStatusBar&&g(Ne.StatusBar,{...t,draft:o,collection:n.schema}),g("div",{className:"DocEditor__fields",children:i.map(s=>g(Ne.Field,{field:s,deepKey:`fields.${s.id}`},s.id))})]})})})}Ne.StatusBar=t=>{let{route:e,query:n}=nC(),{roles:o}=Fd(),r=window.firebase.user.email||"",i=Bd(o,r),s=CE(o,r),a=t.draft,[l,c]=R(a.controller.getData());Fo("sys",S=>{c({sys:S})});let d=we(S=>{S==="unlocked"&&a.controller.removePublishingLock()},[a.controller]),u=vE({docId:t.docId,onChange:d}),p=we(S=>{if(S.action==="delete"){let N=t.docId.split("/")[0];e(`/cms/content/${N}`)}else S.action==="unlocked"&&a.controller.removePublishingLock()},[t.docId]),f=we(()=>{if(!s)return;let S=l?.sys?.publishingLocked;S&&u.open({existingLock:{reason:S.reason,until:S.until?S.until.toMillis():void 0}})},[s,l?.sys?.publishingLocked,u]),h=JE({docId:t.docId}),m=WE(),[_,b]=R(()=>{try{let S=window.localStorage.getItem("root::DocumentPage::checksVisible");return S?JSON.parse(S)===!0:!1}catch{return!1}}),[y,x]=R(()=>{try{let S=window.localStorage.getItem("root::DocumentPage::searchVisible");return S?JSON.parse(S)===!0:!1}catch{return!1}}),[v,E]=R(()=>{try{let S=window.localStorage.getItem("root::DocumentPage::aiVisible");return S?JSON.parse(S)===!0:!1}catch{return!1}}),C=!!(window.__ROOT_CTX.ai||window.__ROOT_CTX.experiments?.ai);P(()=>{let S=N=>{b(N.detail===!0)};return window.addEventListener("root:checks-visible",S),()=>window.removeEventListener("root:checks-visible",S)},[]),P(()=>{let S=N=>{x(N.detail===!0)};return window.addEventListener("root:search-visible",S),()=>window.removeEventListener("root:search-visible",S)},[]),P(()=>{let S=N=>{E(N.detail===!0)};return window.addEventListener("root:ai-visible",S),()=>window.removeEventListener("root:ai-visible",S)},[]);let k=n.locale||"",T=n.modal||"";P(()=>{T==="localization"&&a.controller&&m.open({docId:t.docId,collection:t.collection,draft:a.controller,locale:k||void 0})},[]);let w=!l?.sys;return w?null:g("div",{className:"DocEditor__statusBar",children:[g("div",{className:"DocEditor__statusBar__viewers",children:g(nT,{id:`doc/${t.docId}`})}),g(Ne.SaveState,{}),l?.sys&&g("div",{className:"DocEditor__statusBar__statusBadges",children:g(yC,{doc:l,docId:t.docId,onPublishingLockClick:s?f:void 0})}),g("div",{className:"DocEditor__statusBar__buttonGroup",children:[g("div",{className:"DocEditor__statusBar__search",children:g(De,{label:"\u2318 + Shift + f",transition:"pop",withArrow:!0,children:g(ee,{className:Se("DocEditor__statusBar__buttonGroup__button",y?"DocEditor__statusBar__buttonGroup__button--active":""),variant:"default",color:"dark",size:"xs",leftIcon:g(Dd,{size:16}),onClick:()=>{window.dispatchEvent(new CustomEvent("root:toggle-search"))},children:"Search"})})}),(window.__ROOT_CTX.checks||[]).length>0&&g("div",{className:"DocEditor__statusBar__checks",children:g(ee,{className:Se("DocEditor__statusBar__buttonGroup__button",_?"DocEditor__statusBar__buttonGroup__button--active":""),variant:"default",color:"dark",size:"xs",leftIcon:g(VC,{size:16}),onClick:()=>{window.dispatchEvent(new CustomEvent("root:toggle-checks"))},children:"Checks"})}),C&&g("div",{className:"DocEditor__statusBar__ai",children:g(De,{label:"\u2318 + i",transition:"pop",withArrow:!0,children:g(ee,{className:Se("DocEditor__statusBar__buttonGroup__button",v?"DocEditor__statusBar__buttonGroup__button--active":""),variant:"default",color:"dark",size:"xs",leftIcon:g(Ki,{size:16}),onClick:()=>{window.dispatchEvent(new CustomEvent("root:toggle-ai"))},children:"Root AI"})})})]}),g("div",{className:"DocEditor__statusBar__i18n",children:g(ee,{variant:"default",color:"dark",size:"xs",leftIcon:g(ZC,{size:16}),onClick:()=>{m.open({docId:t.docId,collection:t.collection,draft:a.controller,locale:n.locale||void 0})},children:"Localization"})}),g("div",{className:"DocEditor__statusBar__publishButton",children:w?g(ee,{color:"dark",size:"xs",onClick:()=>h.open(),loading:!0,disabled:!0,children:"Publish"}):pC(l)?g(De,{label:`Scheduled ${rC(l.sys.scheduledAt)} by ${l.sys.scheduledBy}`,transition:"pop",children:g(ee,{color:"dark",size:"xs",leftIcon:g(fh,{size:16}),disabled:!0,children:"Publish"})}):fC(l)?g(De,{label:xC(l),transition:"pop",children:g(ee,{color:"dark",size:"xs",leftIcon:g(YC,{size:16}),disabled:!0,children:"Publish"})}):g(NE,{label:"You don't have access to publish this document",condition:!i,children:g(ee,{color:"dark",size:"xs",leftIcon:g(fh,{size:16}),onClick:()=>h.open(),disabled:!i,children:"Publish"})})}),g("div",{className:"DocEditor__statusBar__actionsMenu",children:g(DE,{docId:t.docId,data:l,onAction:p})})]})};Ne.SaveState=()=>{let[t,e]=R("NO_CHANGES");return kE(n=>{e(n)}),g("div",{className:"DocEditor__statusBar__saveState",children:[t==="SAVED"&&"saved!",t==="SAVING"&&"saving...",t==="UPDATE_PENDING"&&"saving...",t==="ERROR"&&"error saving"]})};Ne.Field=t=>t.field.deprecated?g(Ne.DeprecatedField,{...t}):g(Ne.FieldBody,{...t});Ne.DeprecatedField=t=>{let[e,n]=R(!0),o=Zf();return Fo(t.deepKey,r=>{n(Yi(t.field,r,o))}),e?null:g(Ne.FieldBody,{...t})};Ne.FieldBody=t=>{let e=t.field,n=t.level??0,r=Vl().value===t.deepKey,i=Y(null),s=J(()=>e.type==="object"&&(e.variant||"drawer")==="drawer"?!1:!t.hideHeader&&!e.hideLabel,[t.hideHeader,e]);return P(()=>{r&&Sg(i.current)},[r]),g("div",{className:Se("DocEditor__field",e.deprecated&&"DocEditor__field--deprecated",r&&"deeplink-target"),"data-type":e.type,"data-level":n,id:t.deepKey,ref:i,children:[s&&g(Ne.FieldHeader,{...t}),g("div",{className:"DocEditor__field__input",children:e.type==="array"?g(Ne.ArrayField,{...t}):e.type==="boolean"?g(oT,{...t}):e.type==="date"?g(rT,{...t}):e.type==="datetime"?g(VT,{...t}):e.type==="file"?g(zd,{...t}):e.type==="image"?g(WT,{...t}):e.type==="multiselect"?g(GT,{...t}):e.type==="number"?g(YT,{...t}):e.type==="object"?g(Ne.ObjectField,{...t}):e.type==="oneof"?g(Ne.OneOfField,{...t}):e.type==="reference"?g(ua,{...t}):e.type==="references"?g(JT,{...t}):e.type==="richtext"?g(HL,{...t}):e.type==="select"?g(KL,{...t}):e.type==="string"?g(jL,{...t}):g("div",{className:"DocEditor__field__input__unknown",children:["Unknown field type: ",e.type]})})]})};Ne.FieldHeader=t=>{let e=t.field,n=e.label||e.id,o=Vl(),r=J(()=>Jw(t.deepKey||""),[t.deepKey]);return g("div",{className:Se(t.className,"DocEditor__FieldHeader"),children:[e.deprecated?g("div",{className:"DocEditor__FieldHeader__label",children:["DEPRECATED: ",n]}):g("div",{className:"DocEditor__FieldHeader__label",children:[g("span",{children:n}),t.deepKey&&g("a",{className:"DocEditor__FieldHeader__label__deeplink",href:r,tabIndex:-1,title:"Link to field",onClick:i=>{i.preventDefault(),window.history.replaceState({},"",r),o.setValue(t.deepKey)},children:"#"})]}),e.help&&g("div",{className:"DocEditor__FieldHeader__help",children:e.help}),g(Ne.FieldHeaderTranslationsActionIcon,{field:e,deepKey:t.deepKey})]})};Ne.FieldHeaderTranslationsActionIcon=t=>{let n=!!t.field.translate,r=(window.__ROOT_CTX.rootConfig.i18n||{}).locales||["en"];return!n||r.length<=1?null:g(Ne.FieldHeaderTranslationsActionIconInner,{...t})};Ne.FieldHeaderTranslationsActionIconInner=t=>{let e=t.field,n=HE(),o=Hn(),[r,i]=R(()=>o.controller.getValue(t.deepKey));Fo(t.deepKey,d=>{i(d)});let s=Zf(),a=J(()=>Yi(e,r,s),[e,s,r]),[l,c]=R(!1);return P(()=>{if(!t.deepKey||!o.controller)return;let d=gW(t.deepKey);return o.controller.subscribe(d,p=>{c(p?.translate===!1)})},[t.deepKey,o.controller]),g("div",{className:"DocEditor__FieldHeader__translate",children:l?g(De,{label:"Translations are disabled",children:g(Pe,{size:"xs",onClick:()=>{let d=o.controller.getData();if(!d)return;let u=new Set;_h(u,e,r,s);let p=Array.from(u);n.open({docId:o.controller.docId,strings:p,l10nSheet:d?.sys?.l10nSheet,field:{id:e.id||t.deepKey,deepKey:t.deepKey},draft:o})},children:g(KC,{size:16})})}):a?g("div",{className:"DocEditor__FieldHeader__translate__iconDisabled",children:g(Hi,{size:16})}):g(De,{label:"Show translations",children:g(Pe,{size:"xs",onClick:()=>{let d=o.controller.getData();if(!d)return;let u=new Set;_h(u,e,r,s);let p=Array.from(u);n.open({docId:o.controller.docId,strings:p,l10nSheet:d?.sys?.l10nSheet,field:{id:e.id||t.deepKey,deepKey:t.deepKey},draft:o})},children:g(Hi,{size:16})})})})};Ne.ObjectField=t=>{let e=t.field,n=e.variant;return n||(t.isArrayChild?n="inline":n="drawer"),n==="drawer"?g(Ne.ObjectFieldDrawer,{...t}):g("div",{className:"DocEditor__ObjectField",children:g("div",{className:"DocEditor__ObjectField__fields",children:e.fields.map(o=>g(Ne.Field,{field:o,deepKey:`${t.deepKey}.${o.id}`},o.id))})})};Ne.ObjectFieldDrawer=t=>{let e=t.field,n=e.drawerOptions?.collapsed||!1,o=e.drawerOptions?.inline||!1,r=Hn().controller,i=kg(),s=Ch(),a=Mt(),l=at(),c=Vl(),d=!n||c.value.includes(t.deepKey),u=()=>{let _=r.getValue(t.deepKey)||{};i.set(_),ve({message:"Copied to clipboard",autoClose:2e3})},p=async()=>{let _=await i.get();if(!_||typeof _!="object"){ve({message:"Clipboard empty (nothing to paste)",color:"red",autoClose:2e3});return}r.updateKey(t.deepKey,_),ve({message:"Pasted from clipboard",autoClose:2e3})},f=async _=>{await r.removeKey(t.deepKey),ve({message:"Cleared",autoClose:2e3}),await r.flush(),_&&a.closeModal(_)},h=()=>{let _=e.label||e.id||"drawer",b=a.openConfirmModal({...l,title:`Clear ${_}?`,children:g(Ui,{size:"body-sm",weight:"semi-bold",className:"DocEditor__ObjectFieldDrawer__confirmText",children:"This will clear all values in this section. There is no undo."}),labels:{confirm:"Clear",cancel:"Cancel"},cancelProps:{size:"xs"},confirmProps:{color:"red",size:"xs"},closeOnConfirm:!1,onConfirm:()=>f(b)})},m=()=>{let _=r.getValue(t.deepKey)||{};s.open({data:_,onSave:b=>{r.updateKey(t.deepKey,b),s.close()}})};return g("div",{className:Se("DocEditor__ObjectFieldDrawer",o&&"DocEditor__ObjectFieldDrawer--inline"),children:g("details",{className:"DocEditor__ObjectFieldDrawer__drawer",open:d,children:[g("summary",{className:"DocEditor__ObjectFieldDrawer__drawer__toggle",children:[g("div",{className:"DocEditor__ObjectFieldDrawer__drawer__toggle__icon",children:g(TC,{size:16})}),g(Ne.FieldHeader,{className:"DocEditor__ObjectFieldDrawer__drawer__toggle__header",field:e,deepKey:t.deepKey}),g(X,{className:"DocEditor__ObjectFieldDrawer__drawer__menu",position:"bottom",transitionDuration:0,control:g(Pe,{className:"DocEditor__ObjectFieldDrawer__drawer__menu__dots",onClick:_=>{_.stopPropagation(),_.preventDefault()},children:g(Cd,{size:16})}),children:[g(X.Label,{children:"CLIPBOARD"}),g(X.Item,{className:"DocEditor__ObjectFieldDrawer__drawer__menu__item",icon:g(dh,{size:18}),onClick:u,children:"Copy"}),g(X.Item,{className:"DocEditor__ObjectFieldDrawer__drawer__menu__item",icon:g(xd,{size:18}),onClick:p,children:"Paste"}),g(X.Label,{children:"CODE"}),g(X.Item,{className:"DocEditor__ObjectFieldDrawer__drawer__menu__item",icon:g(ch,{size:18}),onClick:m,children:"Edit JSON"}),g(X.Label,{children:"ACTIONS"}),g(X.Item,{className:"DocEditor__ObjectFieldDrawer__drawer__menu__item",icon:g(ho,{size:18}),onClick:h,children:"Clear"})]})]}),g("div",{className:"DocEditor__ObjectFieldDrawer__drawer__content DocEditor__ObjectFieldDrawer__fields",children:e.fields.map(_=>g(Ne.Field,{field:_,deepKey:`${t.deepKey}.${_.id}`},_.id))})]})})};function uW(t,e){switch(e.type){case"update":{let n=t._new||[];return{...e.newValue,_new:n}}case"updateItem":{let n=t??{},r=[...n._array||[]][e.index],i=e.newValue??{};return e.draft.updateKey(`${e.deepKey}.${r}`,i),{...n,[r]:i}}case"add":{let n=t??{},o=pr(),r=structuredClone(e.defaultValue||{}),i=[...n._array||[],o];e.draft.updateKeys({[`${e.deepKey}._array`]:i,[`${e.deepKey}.${o}`]:r});let s=t._new||[];return{...n,[o]:r,_array:i,_new:[...s,o]}}case"insertBefore":{let n=t??{},o=[...n._array||[]],r=pr(),i=structuredClone(e.defaultValue||{});o.splice(e.index,0,r),e.draft.updateKeys({[`${e.deepKey}._array`]:o,[`${e.deepKey}.${r}`]:i});let s=t._new||[];return{...n,[r]:i,_array:o,_new:[...s,r]}}case"insertAfter":{let n=t??{},o=[...n._array||[]],r=pr(),i=structuredClone(e.defaultValue||{});o.splice(e.index+1,0,r),e.draft.updateKeys({[`${e.deepKey}._array`]:o,[`${e.deepKey}.${r}`]:i});let s=t._new||[];return{...n,[r]:i,_array:o,_new:[...s,r]}}case"duplicate":{let n=t??{},o=[...n._array||[]],r=pr(),i=structuredClone(e.value);o.splice(e.index+1,0,r),e.draft.updateKeys({[`${e.deepKey}._array`]:o,[`${e.deepKey}.${r}`]:i});let s=t._new||[];return{...n,[r]:i,_array:o,_new:[...s,r]}}case"moveUp":{if(e.index===0)return t;let n=t??{},o=[...n._array||[]];return VL(o,e.index,e.index-1),e.draft.updateKeys({[`${e.deepKey}._array`]:o}),{...n,_array:o,_moved:o[e.index-1]}}case"moveDown":{let n=t??{},o=[...n._array||[]];return e.index>=o.length-1?t:(VL(o,e.index,e.index+1),e.draft.updateKeys({[`${e.deepKey}._array`]:o}),{...n,_array:o,_moved:o[e.index+1]})}case"moveTo":{let n=t??{},o=[...n._array||[]];if(e.fromIndex<0||e.fromIndex>=o.length||e.toIndex<0||e.toIndex>=o.length)return console.error("Invalid moveTo index",e),t;let r=o[e.fromIndex];return pW(o,e.fromIndex,e.toIndex),e.draft.updateKeys({[`${e.deepKey}._array`]:o}),{...n,_array:o,_moved:r}}case"removeAt":{let n={...t??{}},r=[...n._array||[]],i=r[e.index];return delete n[i],r.splice(e.index,1),e.draft.updateKeys({[`${e.deepKey}._array`]:r}),e.draft.removeKey(`${e.deepKey}.${i}`),{...n,_array:r}}case"pasteAfter":{let n=t??{},o=[...n._array||[]],r=pr(),i=e.data;if(!i)return ve({title:"Skipped",message:"Nothing to paste.",autoClose:!0}),t;o.splice(e.index+1,0,r),e.draft.updateKeys({[`${e.deepKey}._array`]:o,[`${e.deepKey}.${r}`]:i});let s=t._new||[];return{...n,[r]:i,_array:o,_new:s,_pasted:r}}case"pasteBefore":{let n=t??{},o=[...n._array||[]],r=pr(),i=e.data;if(!i)return ve({title:"Skipped",message:"Nothing to paste.",autoClose:!0}),t;o.splice(e.index,0,r),e.draft.updateKeys({[`${e.deepKey}._array`]:o,[`${e.deepKey}.${r}`]:i});let s=t._new||[];return{...n,[r]:i,_array:o,_new:s,_pasted:r}}default:return console.error("unknown action",e),t}}Ne.ArrayField=t=>{let e=Hn().controller,n=t.field,[o,r]=$v(uW,{_array:[]}),i=Vl(),s=kg(),a=window.__ROOT_CTX.experiments||{},c=(o??{})._array||[],d=o._new||[],[u,p]=R(null);Fo(t.deepKey,B=>{r({type:"update",newValue:B})}),P(()=>{o._moved?k(t.deepKey,c.indexOf(o._moved)):o._pasted&&k(t.deepKey,c.indexOf(o._pasted))},[o]);let f=B=>{let se=c[B],me=`${t.deepKey}.${se}`;return e.getValue(me)||{}},h=()=>{r({type:"add",draft:e,deepKey:t.deepKey,defaultValue:n.itemDefault||{}})},m=(B,se)=>{r({type:"pasteBefore",draft:e,deepKey:t.deepKey,index:B,data:se})},_=(B,se)=>{r({type:"pasteAfter",draft:e,deepKey:t.deepKey,index:B,data:se})},b=async B=>{m(B,await s.get())},y=async B=>{_(B,await s.get())},x=B=>{r({type:"insertBefore",draft:e,deepKey:t.deepKey,index:B,defaultValue:n.itemDefault||{}})},v=B=>{r({type:"insertAfter",draft:e,deepKey:t.deepKey,index:B,defaultValue:n.itemDefault||{}})},E=B=>{r({type:"duplicate",draft:e,deepKey:t.deepKey,index:B,value:f(B)})},C=B=>{r({type:"removeAt",draft:e,deepKey:t.deepKey,index:B})},k=(B,se)=>{document.getElementById(`summary-for-${B}.${c[se]}`)?.focus()},T=B=>{B>0&&r({type:"moveUp",draft:e,deepKey:t.deepKey,index:B})},w=B=>{B<c.length-1&&r({type:"moveDown",draft:e,deepKey:t.deepKey,index:B})},S=B=>{let se=f(B);s.set(se),p(null),ve({message:"Copied to clipboard",autoClose:2e3})},N=B=>{let se=f(B);s.set(se),p(B),ve({message:"Cut to clipboard",autoClose:2e3})},D=async B=>{let se=await s.get();if(!se){ve({message:"Clipboard empty (nothing to paste)",color:"red",autoClose:2e3});return}if(_(B,se),u!==null){let me=u;B<u&&(me+=1),C(me),p(null)}ve({message:"Pasted item",autoClose:2e3})},O=Ch(),M=PE(),I=B=>{let se=f(B);O.open({data:se,onSave:me=>{console.log("[edit json] onSave()",me),r({type:"updateItem",draft:e,index:B,newValue:me,deepKey:t.deepKey}),O.close()}})},L=B=>{let se=f(B);M.open({data:se,onSave:me=>{console.log("[ai edit] onSave()",me),r({type:"updateItem",draft:e,index:B,newValue:me,deepKey:t.deepKey}),M.close()}})};function K(B){return!!i.value.startsWith(`${t.deepKey}.${B}`)}let W=we((B,se)=>{if(!B.target)return;let me=c.indexOf(se);B.metaKey&&B.key==="x"?(B.preventDefault(),N(me)):B.metaKey&&B.key==="c"?(B.preventDefault(),S(me)):B.metaKey&&B.key==="v"?(B.preventDefault(),D(me)):B.metaKey&&(B.key==="Backspace"||B.key==="Delete")?(B.preventDefault(),C(me),ve({message:"Deleted item",autoClose:2e3})):B.key==="ArrowUp"?(B.preventDefault(),T(me)):B.key==="ArrowDown"?(B.preventDefault(),w(me)):B.key==="ArrowLeft"?B.target.closest("details").open=!1:B.key==="ArrowRight"&&(B.target.closest("details").open=!0)},[t.deepKey,c,u]),q=g("div",{className:"DocEditor__ArrayField__add",children:[g(ee,{className:"DocEditor__ArrayField__add__button",color:"dark",size:"xs",leftIcon:g(NC,{size:16}),onClick:()=>h(),children:n.buttonLabel||"Add"}),g(X,{className:"DocEditor__ArrayField__add__menu",control:g(Pe,{className:"DocEditor__ArrayField__item__header__controls__dots",children:g(Cd,{size:16})}),children:[g(X.Label,{children:"CLIPBOARD"}),g(X.Item,{className:"DocEditor__ArrayField__menu__item",icon:g(Nd,{size:18}),onClick:()=>D(c.length-1),children:"Paste item to end"})]})]});return c.length===0&&!o._new?g("div",{className:"DocEditor__ArrayField",children:[g("div",{className:"DocEditor__ArrayField__items",children:g("div",{className:"DocEditor__ArrayField__items__empty",children:"No items"})}),q]}):g("div",{className:"DocEditor__ArrayField",children:[g(ru,{onDragEnd:B=>{let{source:se,destination:me}=B;me&&r({type:"moveTo",fromIndex:se.index,toIndex:me.index,draft:e,deepKey:t.deepKey})},children:g(su,{droppableId:"dnd-list",direction:"vertical",children:B=>g("div",{...B.droppableProps,ref:B.innerRef,className:"DocEditor__ArrayField__items",children:[c.map((se,me)=>g(Ne.ArrayFieldItem,{field:n,parentDeepKey:t.deepKey,itemKey:se,index:me,initialOpen:d.includes(se)||K(se)||!!n.defaultOpen,isCut:u===me,aiEnabled:!!a.ai,onFocusHeader:k,onHeaderKeyDown:W,onMoveUp:T,onMoveDown:w,onInsertBefore:x,onInsertAfter:v,onDuplicate:E,onCopy:S,onPasteBefore:b,onPasteAfter:y,onEditJson:I,onAiEdit:L,onRemove:C},se)),B.placeholder]})})}),q]})};Ne.ArrayFieldItem=t=>{let e=`${t.parentDeepKey}.${t.itemKey}`;return g(iu,{index:t.index,draggableId:t.itemKey,children:(n,o)=>g("div",{ref:n.innerRef,...n.draggableProps,className:Se("DocEditor__ArrayField__item__wrapper",o.isDragging&&"DocEditor__ArrayField__item__wrapper--dragging",t.isCut&&"DocEditor__ArrayField__item__wrapper--cut"),children:[g("div",{className:"DocEditor__ArrayField__item__handle",...n.dragHandleProps,onClick:()=>t.onFocusHeader(t.parentDeepKey,t.index),children:g(Ed,{size:18,stroke:"1.5"})}),g("details",{className:"DocEditor__ArrayField__item",open:t.initialOpen,onToggle:r=>{r.target.open?Vn(e,{scroll:!0}):Vn(null)},onMouseEnter:()=>{Vn(e)},onMouseLeave:()=>{Vn(null)},children:[g("summary",{id:`summary-for-${e}`,className:"DocEditor__ArrayField__item__header",onKeyDown:r=>t.onHeaderKeyDown(r,t.itemKey),tabIndex:0,children:[g("div",{className:"DocEditor__ArrayField__item__header__icon",children:g(sE,{size:6})}),g(Ne.ArrayFieldPreview,{field:t.field,deepKey:e,index:t.index}),g("div",{className:"DocEditor__ArrayField__item__header__controls",children:[g("div",{className:"DocEditor__ArrayField__item__header__controls__arrows",children:[g("button",{className:"DocEditor__ArrayField__item__header__controls__arrow DocEditor__ArrayField__item__header__controls__arrows--up",onClick:()=>t.onMoveUp(t.index),children:g(kC,{size:20,strokeWidth:1.75})}),g("button",{className:"DocEditor__ArrayField__item__header__controls__arrow DocEditor__ArrayField__item__header__controls__arrows--down",onClick:()=>t.onMoveDown(t.index),children:g(SC,{size:20,strokeWidth:1.75})})]}),g(X,{className:"DocEditor__ArrayField__item__header__controls__menu",position:"bottom",transitionDuration:0,control:g(Pe,{className:"DocEditor__ArrayField__item__header__controls__dots",children:g(Cd,{size:16})}),children:[g(X.Label,{children:"INSERT"}),g(X.Item,{className:"DocEditor__ArrayField__menu__item",icon:g(hh,{size:18}),onClick:()=>t.onInsertBefore(t.index),children:"Add before"}),g(X.Item,{className:"DocEditor__ArrayField__menu__item",icon:g(Nd,{size:18}),onClick:()=>t.onInsertAfter(t.index),children:"Add after"}),g(X.Item,{className:"DocEditor__ArrayField__menu__item",icon:g(DC,{size:18}),onClick:()=>t.onDuplicate(t.index),children:"Duplicate"}),g(X.Label,{children:"CLIPBOARD"}),g(X.Item,{className:"DocEditor__ArrayField__menu__item",icon:g(dh,{size:18}),onClick:()=>t.onCopy(t.index),children:"Copy"}),g(X.Item,{className:"DocEditor__ArrayField__menu__item",icon:g(hh,{size:18}),onClick:()=>t.onPasteBefore(t.index),children:"Paste before"}),g(X.Item,{className:"DocEditor__ArrayField__menu__item",icon:g(Nd,{size:18}),onClick:()=>t.onPasteAfter(t.index),children:"Paste after"}),g(X.Label,{children:"CODE"}),g(X.Item,{className:"DocEditor__ArrayField__menu__item",icon:g(ch,{size:18}),onClick:()=>t.onEditJson(t.index),children:"Edit JSON"}),t.aiEnabled&&g(X.Item,{className:"DocEditor__ArrayField__menu__item",icon:g(Hd,{size:16}),onClick:()=>t.onAiEdit(t.index),children:"Edit with Root AI"}),g(X.Label,{children:"REMOVE"}),g(X.Item,{className:"DocEditor__ArrayField__menu__item",icon:g(ho,{size:18}),onClick:()=>t.onRemove(t.index),children:"Remove"})]})]})]}),g("div",{className:"DocEditor__ArrayField__item__body",children:g(Ne.Field,{field:t.field.of,deepKey:e,hideHeader:!0,isArrayChild:!0,onFocus:()=>{Vn(e,{scroll:!0})},onBlur:()=>{Vn(null)}},e)})]})]})},t.itemKey)};Ne.ArrayFieldPreview=t=>{let e=Hn().controller,n=Zf(),[o,r]=R(e.getValue(t.deepKey)),i=J(()=>fW(t.field,o,n),[t.field,n,o]),s=J(()=>hW(t.field,o,t.index,n),[t.field,t.index,n,o]),a=J(()=>TE(l=>{r(l&&typeof l=="object"?{...l}:l)},250),[]);return P(()=>e.subscribeSubtree(t.deepKey,a),[t.deepKey,e,a]),g("div",{className:"DocEditor__ArrayField__item__header__preview",children:[i&&g("div",{className:"DocEditor__ArrayField__item__header__preview__image",children:g("img",{src:i,alt:"",className:"DocEditor__ArrayField__item__header__preview__image__img",loading:"lazy"})}),g("div",{className:"DocEditor__ArrayField__item__header__preview__title","data-preview":s})]})};Ne.OneOfField=t=>{let e=t.field,n=e.variant||window.__ROOT_CTX.defaultOneOfVariant||"dropdown",[o,r]=R(""),i=Zf(),s=Array.isArray(e.types)?e.types:[],a={},l=[],c=[{value:"",label:e.placeholder||"Select type"}];s.forEach(v=>{let E,C;typeof v=="string"?(E=i[v],C=v):(E=v,C=v.name),C&&(E&&(a[C]=E,l.push(E)),c.push({value:C,label:C}))});let d=a[o||""],u=Hn().controller,p=FE(),f=J(()=>({}),[]);async function h(v,E){let C={};if(v){let k=a[v];if(E&&k){let T=Xs(k),w=gE(k,E,i);Object.assign(C,bC(T,w))}else v in f?Object.assign(C,f[v]):k&&Object.assign(C,Xs(k))}C._type=v,await u.updateKey(t.deepKey,C),r(v)}async function m(v){await h(v)}Fo(t.deepKey,v=>{r(v?._type||""),v?._type&&(f[v._type]=v)});function _(v){let E=v.target;E&&E.select&&E.select()}function b(){let v=[];return l.forEach(E=>{v.push({key:`${E.name}::__blank__`,schema:E}),(E.presets||[]).forEach(C=>{v.push({key:`${E.name}::${C.id}`,schema:E,preset:C})})}),v}function y(){p.open({options:b(),onSelect:async v=>{await h(v.schema.name,v.preset?.data),p.close()},onRemove:d?async()=>{await h(""),p.close()}:void 0})}let x=d&&g("div",{className:"DocEditor__OneOfField__fields",children:d.fields.map(v=>g(Ne.Field,{field:v,deepKey:`${t.deepKey}.${v.id}`,onBlur:()=>{Vn(null)},onFocus:()=>{Vn(`${t.deepKey}.${v.id}`,{scroll:!0})}},`${o}::${v.id}`))});if(n==="picker"){let v=d?d.label||d.name:e.placeholder||"Select type";return g("div",{className:"DocEditor__OneOfField DocEditor__OneOfField--picker",children:[g("div",{className:"DocEditor__OneOfField__pickerButton",children:[g("div",{className:"DocEditor__OneOfField__select__label",children:"Type:"}),g(ee,{variant:"default",color:"dark",size:"xs",onClick:y,rightIcon:g(to,{size:16}),children:v})]}),x]})}return g("div",{className:"DocEditor__OneOfField",children:[g("div",{className:"DocEditor__OneOfField__select",children:[g("div",{className:"DocEditor__OneOfField__select__label",children:"Type:"}),g(Ro,{data:c,value:o,placeholder:e.placeholder,onChange:v=>m(v||""),onFocus:_,size:"xs",radius:0,searchable:!0,dropdownComponent:"div"})]}),x]})};function VL(t,e,n){if(t.length<=1)return t;let o=t[e];return t[e]=t[n],t[n]=o,t}function pW(t,e,n){let[o]=t.splice(e,1);t.splice(n,0,o)}function GL(t,e,n,o="title"){if(t.type==="oneof"){let r=t,i=e?._type;if(i){let s,a=Array.isArray(r.types)?r.types:[];return typeof a[0]=="string"?s=n[i]:s=a.find(l=>l.name===i),s?.preview?.[o]||null}}return null}function fW(t,e,n){let o=GL(t.of,e,n,"image");if(o)return sa(o,e)}function hW(t,e,n,o){let r=GL(t.of,e,o,"title");if(r){let i=sa(r,e,{index:n});if(i)return i}return t.preview?sa(t.preview,e,{index:n})??`item ${n}`:`item ${n}`}function gW(t){let e=t.split("."),n=e.pop();return[...e,`@${n}`].join(".")}export{uR as a,xh as b,Ch as c,hR as d,wh as e,Th as f,Bo as g,xR as h,uv as i,pv as j,cre as k,$L as l,Ne as m,Wg as n};
|